EF Code First CTP5 includes a bunch of other improvements as
well. Below are a few short descriptions of some of them:
Fluent API Improvements
EF Code First allows you to override an “OnModelCreating()”
method on the DbContext class to further refine/override the schema mapping
rules used to map model classes to underlying database schema. CTP5
includes some refinements to the ModelBuilder class that is passed to this
method which can make defining mapping rules cleaner and more concise.
The ADO.NET Team blogged some samples of how to do this here.
Pluggable Conventions Support
EF Code First CTP5 provides new support that allows you to
override the “default conventions” that EF Code First honors, and optionally
replace them with your own set of conventions.
New Change Tracking API
EF Code First CTP5 exposes a new set of change tracking
information that enables you to access Original, Current & Stored values,
and State (e.g. Added, Unchanged, Modified, Deleted). This support is
useful in a variety of scenarios.
Improved Concurrency Conflict Resolution
EF Code First CTP5 provides better exception messages that
allow access to the affected object instance and the ability to resolve
conflicts using current, original and database values.
Raw SQL Query/Command Support
EF Code First CTP5 now allows raw SQL queries and commands
(including SPROCs) to be executed via the SqlQuery and SqlCommand methods
exposed off of the DbContext.Database property. The results of these
method calls can be materialized into object instances that can be optionally
change-tracked by the DbContext. This is useful for a variety of advanced
Full Data Annotations Support
EF Code First CTP5 now supports all standard DataAnnotations
within .NET, and can use them both to perform validation as well as to
automatically create the appropriate database schema when EF Code First is used
in a database creation scenario.