The ObjectMapper .NET Project

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’;
 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

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