Attribute: [DefaultValue]
Posted by Gerhard Stephan on 13th July 2007
The attribute [DefaultValue] can be used to specify a default value for a property. The [DefaultValue] attribute only affects the creation of the DDL file where a DEFAULT value is added to the field definition of the database.
[PropertyLength(100)]
[DefaultValue("Unkown Company")]
public string LegalName
{
get { return legalName; }
set { legalName = value; }
}
The resulting field definition would be:
LegalName VARCHAR(100) DEFAULT ‘Unkown Company’;
Posted in Attributes | No Comments »
