开发者

Nhibernate .Net attribute mapping. It is possible to set default value?

开发者 https://www.devze.com 2023-01-30 18:24 出处:网络
It is possible to set a default value for attribute mapping ? Example, if i have this property : private string sDoorLength;

It is possible to set a default value for attribute mapping ? Example, if i have this property :

private string sDoorLength;
[NHibernate.Mapping.Attributes.Property(Column = "door_length")]
public string DoorLeng开发者_JS百科th { get { return sDoorLength; } set { sDoorLength = value; } }

I want to know if it's possible to add a parameter to NHibernate.Mapping.Attributes.Property for setting a default value. Like [NHibernate.Mapping.Attributes.Property(Column = "door_length", Default="Test")] or something like that.

Thank you !


You could initialize the private field to a default value.

private string sDoorLength = "Test";
0

精彩评论

暂无评论...
验证码 换一张
取 消