Most-Wanted Features in Entity Framework

The EF team has setup a uservoice forum to let users request and vote for features. We are highlighting the current top 7 most-voted-for feature requests, along with possible workarounds you can use today.

These are the top requested features as of today -

Improved SQL Generation (status=Started)

The request - 

I have seen simple select statements with 4 or 5 includes result in nearly 5000 line SQL statements when an equivalent hand-written SQL statement is ~15 lines..

MS has already made some progress on this. Their response - 

The update for the core EF libraries that will be included in .NET 4.5 will include some improvements in SQL generation. However not all the scenarios mentioned in the comments will be addressed.

Workaround: No real workaround, except to stop using EF.

 

Batch CUD support (status=Under Review)

Batching of Creates/Updates/Deletes is a key feature for LOB applications that’s probably missing in most ORMs. Older programming languages like DBase and PowerBuilder had this capability decades ago. Some even suggest that ORMs are not meant for bulk transactions and are most suited for OLTP and not batch processing.

Workarounds –

  • This extension to EF provides ability to do bulk updates and deletes (but no bulk inserts)
  • Don’t use Entity Framework for Bulk transactions - write the SQL yourself. In fact this is probably a good place to avoid using the ORM.

 

EF Support for Second Level Cache (status=Under Review)

This is something supported by NHibernate but not yet by Entity Framework out-of-the-box.

Workaround – Julie Lerman shows how to use Windows Server AppFabric as a second cache in her article “Second-Level Caching in the Entity Framework and AppFabric

 

Entity Designer: Speed up & Optimize for using with ~200+ entities

Workaround: Break up the model once it reaches 50-100 entities. This old blog post is still relevant as to why supporting this is not only a technical but also a user-experience challenge. Not sure if MS is going to consider this one, even though it has been voted for.

 

Support for multiple databases (status=Under Review)

Not supported out-of-box since the model is currently always mapped to a single database.

Workaround – Need to use synonyms, merge two models and trick EF to span multiple databases.

 

Designer Support GUID as Entity Key – This is more of a bug than a feature where adding the StoreGeneratedPattern attribute on a GUID column using the designer does not update the storage part of the data model. This causes GUID column to get “000..” value while creating new records.

Workaround – Add the StoreGeneratedPattern attribute by hand in the .edmx file as explained here.

 

Schema Migration a la Rails Migrations (coming in EF 4.3 as Code-First Migrations)

This feature is currently in beta along with EF 4.3. More details about the feature on the msdn blog.

Workaround – Use the database project to create upgrade scripts. Once the Code first drops and recreates a new schema, import it into a new database project, and then deploy it to the old database.

 

There are many other interesting feature ideas raised by various users, be sure to cast your votes or submit your own ideas and let the EF team know what is important for you!

你可能感兴趣的:(framework)