1
而在 http://www.codeproject.com/Articles/380215/Understanding-MVP-WCSF-Over-ASP-NET-Web-Forms?msg=4970179#xx4970179xx 阅读本教程中,我找到属性使用[CreateNew]财产演示ASP.NET C#[createnew]属性属性
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this._presenter.OnViewInitialized();
}
this._presenter.OnViewLoaded();
}
[CreateNew]
public ProductPresenter Presenter
{
get
{
return this._presenter;
}
set
{
if (value == null)
throw new ArgumentNullException("value");
this._presenter = value;
this._presenter.View = this;
}
}
这里是方法的参数之前使用
private IProductsController _controller;
public ProductPresenter([CreateNew] IProductsController controller)
{
//// Method on controller class invoked here
_controller = controller;
}
属性[CreateNew] meand属性之前是什么?它与方法参数一起使用时意味着什么?谢谢。
的链接,内容教程表看起来是这样的:http://msdn.microsoft.com/en-us/library/microsoft.practices.objectbuilder。 createnewattribute.aspx。你可以谷歌这样的东西,如“CreateNewAttribute C#” –
非常感谢,它仍然不告诉我它是如何影响财产或方法? –
[使用ObjectBuilder](http://msdn.microsoft.com/zh-cn/library/ff699209.aspx) –