DataAnnotations - Key Attribute: Key attribute can be applied to properties of a class. Default Code-First convention creates a primary key column for a property whose name is "Id" or {Class Name} + "Id". Key attribute overrides this d…
DataAnnotations - StringLength Attribute: StringLength attribute can be applied to a string type property of a class. EF Code-First will set the size of a column as specified in StringLength attribute. Note that it can also be used with ASP.Net MVC a…
DataAnnotations - MaxLength Attribute: MaxLength attribute can be applied to a string or array type property of a domain class. EF Code First will set the size of a column as specified in MaxLength attribute. Note that it can also be used with ASP.Ne…
DataAnnotations - NotMapped Attribute: NotMapped attribute can be applied to properties of a class. Default Code-First convention creates a column for all the properties which includes getters and setters. NotMapped attribute overrides this default c…
DataAnnotations - ForeignKey Attribute: ForeignKey attribute can be applied to properties of a class. Default Code-First convention for ForeignKey relationship expects foreign key property name match with primary key property. Consider the following…
DataAnnotations - Column Attribute: Column attribute can be applied to properties of a class. Default Code First convention creates a column name same as the property name. Column attribute overrides this default convention. EF Code-First will create…
DataAnnotations - Table Attribute: Table attribute can be applied to a class. Default Code-First convention creates a table name same as the class name. Table attribute overrides this default convention. EF Code-First will create a table with a speci…
DataAnnotations - TimeStamp Attribute: TimeStamp attribute can be applied to only one byte array property of a domain class. TimeStamp attribute creates a column with timestamp datatype. Code-First automatically use this TimeStamp column in concurren…
Required attribute can be applied to a property of a domain class. EF Code-First will create a NOT NULL column in a database table for a property on which we apply Required attribute. Note that it can also be used with ASP.Net MVC as a validation att…
ConcurrencyCheck Attribute: ConcurrencyCheck attribute can be applied to a property of a domain class. Code First takes the value of a column in "where" clause when EF executes update command for the table. You can use ConcurrencyCheck attribute…