Most Important Limitations Of The Entity Framework [closed]
What are the most important limitations of the ADO.NET Entity Framework 4.0 that business application developers should be aware of?
I have used it in some pet projects of mine and it seems very efficient, but I am concerned about the problems I will face when I am building large, more complex data-driven business applications. I am especially interested in how choosing to use the Entity Framework to access my data might limit the different design patters/architectures tha开发者_JAVA百科t I might want to use when building my project.
Because I am thinking about using the entity framework in future projects, I am only interested in limitations of the current version of the Entity Framework.
You need to be aware of database chatter. Persisting an entire object graph is not really a good idea. When doing a complex query and update, EF will always try update the inserted objects. The solution to this is having complex query and update logic in a stored proc and by passing object graphs in via XML/string, etc for a single DB call.
Another issue with EF when doing design first or DB first modelling is that the Entity classes themselves are coupled to the framework via inheritance. There are several strategies around this, I have a blog post that lets to use POCO's while extracting an interface at the same time for mocking, which is really handy.
Getting the entity framework to Generate an interface for Mocking
This should probably be a CWiki, however i'll roll with the punches.
The key to a good EF implementation is an intelligent mixture of correct domain modelling (TPT for flexibility, TPH for performance, inheritance), abstraction of persistence logic (repository pattern, POCOs, dependency injection), and knowing when to use stored procedures for database-intensive tasks.
If you want to get into the nitty-gritty, the only limitations i have found with EF is lack of enum mapping support (this should be fixed soon though).
IMO, the limitation isn't really in the product, it's in the developer's lack of adherence to common architectural principals and guidelines.
精彩评论