use*_*315 5 .net c# csla nhibernate
我是C#,csla和NHibernate的新手。这可能是一个新手问题,但我没有在其他地方看到明确的解释。有人可以帮助我了解两者之间的区别吗
public int Property
{
get { return GetProperty<int>(Property); }
private set { SetProperty<int>(Property, value); }
}
Run Code Online (Sandbox Code Playgroud)
和
public int Property{get;set;}
Run Code Online (Sandbox Code Playgroud)
CSLA 实现了一种强大的新方法来实现属性,您无需声明字段来存储属性的值。字段值由 CSLA .NET 管理,因此称为托管字段。将来,除非您使用托管字段,否则 CSLA .NET 的某些高级功能可能不可用。
句法 :
public string Name
{
get { return GetProperty<string>(NameProperty); }
set { SetProperty<string>(NameProperty, value); }
}
Run Code Online (Sandbox Code Playgroud)
CSLA 还支持不同的语法,您可以使用私有字段来存储值。此技术比使用托管字段更快,但要求您声明并维护自己的字段。
希望这能让您对GetProperty和SetProperty