Attribute: [Required]
Posted by Gerhard Stephan on September 7th, 2006
You can use the Required attribute to force that the property must be filled. Within the DDL creation process the ObjectMapper .NET adds a "NOT NULL" to the column definition.
This can be used to create mandatory fields that are checked by database. If you try to store an empty property that is marked as required, the database will throw an exception.
Here’s an example how to mark a property as required.
[Required]
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
