Sebastien Robert
Sebastien Robert

Reputation: 331

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

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 DoorLength { 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 !

Upvotes: 1

Views: 956

Answers (1)

Nick Patterson
Nick Patterson

Reputation: 944

You could initialize the private field to a default value.

private string sDoorLength = "Test";

Upvotes: 2

Related Questions