How to create a Code-First EF model

EF 4.1 introduces two new features

  • The DbContext API is a simplified abstraction over ObjectContext and a number of other types
  • Code First is a new development pattern that provides an alternative to the Database First and Model First patterns

Code First is focused around defining your model using .NET classes. These classes can then be mapped to an existing database or be used to generate a database schema. Additional configuration can be supplied using Data Annotations or via a fluent API. Continue reading “How to create a Code-First EF model”