Chưa phân loại

Top Ten New Features in Entity Framework 4.0

The Entity Framework team at Microsoft has been extremely busy this past year to get a new version of the Entity Framework out the door. The first release (which shipped last summer with .NET 3.5 SP1) generated a fair amount of criticism, especially because it lacked many features present in LINQ to SQL, such as POCO (Plain Old CLR Objects) support, and required developers to write excessive amounts of code to deal with things like concurrency and n-tier scenarios.

In response, the EF team published an Entity Framework Design Blog, soliciting feedback from the community on critical design decisions. The team has also published a series of posts on new features on the ADO.NET Team Blog. We now have the first CTP of EF4 and the MSDN documentation is online.

EF4 comes with a boat load of features, so many in fact that it\’s hard to know where to begin! To help break them down, I have compiled a top-ten list of EF4 features. These are listed in relative order of importance.

  1. Define your own objects that are completely decoupled from persistence concerns.

  2. Create customized code generation templates (for example, POCO classes).

  3. Load related entities automatically on-demand.

  4. Different options for tracking changes to entities.

  5. Propagate entity changes across service boundaries for batch updates.

  6. The tools fix up entity names in case database tables are in plural form (Northwind!).

  7. Create an entity model and generate the database from it.

  8. Create classes without a model.

  9. Have more control over storage, conceptual and mapping schemas.

  10. Miscellaneous Improvements

a. Complex Type Support

Create complex types in your model.

b. Foreign Keys

Optionally include foreign keys in your model.

c. LINQ to Entities Functions and Operators

Call database, conceptual and model-defined functions from L2E queries.

d. Testability Improvements with IObjectSet<T>

Test-driven development is easier now.

e. T-SQL Readability and Performance

Generated SQL is faster, simpler and easier to read.

Hats off to the EF team for responding to almost all our requests. Mapping multiple stored procedure results to complex entities is still not supported, but there has to be something for the next version.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s