Entity FrameworkCode First DataAnnotations


Remarks

Entity Framework Code-First provides a set of DataAnnotation attributes, which you can apply to your domain classes and properties. DataAnnotation attributes override default Code-First conventions.

  1. System.ComponentModel.DataAnnotations includes attributes that impacts on nullability or size of the column.
  2. System.ComponentModel.DataAnnotations.Schema namespace includes attributes that impacts the schema of the database.

Note: DataAnnotations only give you a subset of configuration options. Fluent API provides a full set of configuration options available in Code-First.