Entity Framework Column Data Annotations
In EF 6, the default convention creates a column name similar to the property name in an entity class.
- It is also the same as
Tableattribute, butTableattribute overrides the table behavior whileColumnattribute overrides the column behavior. - It will create a column in a database with a specified name in the
Columnattribute for a given property.
The following example maps the BookTitle property in the Book entity to a database column named Title.
public class Book { public int BookId { get; set; } [Column("Title")] public string BookTitle { get; set; } }
ZZZ Projects