AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Attribute: [DefaultValue]

Posted by Gerhard Stephan on July 13th, 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';

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>