开发者

What is the most annoying feature (or lack of feature) you have found in the Entity Framework?

I am starting wi开发者_如何学Goth the Entity Framework. It sounds great. But I am wondering if I should watch out for some weakness somewhere. Any experience there?


You probably need to start prefixing these questions with the version you are talking about. A good amount of the annoyances have been fixed in the upcoming version in .NET 4.0.

Here is what I would say after working with the first version for about 6 months using a decent size DB in sql 2k8(40+ tables, several tables with close to 1M rows, and decent amount of traffic)

  • Lack of Foreign key properties. Meaning if I want to know or work with just the id of a related table I have to load the actual entity. (fixed in next version)
  • Utter lack of an easy outer join like linq to sql has when using DefaultIfEmpty. Fixed in next version.
  • Generated Sql is less than optimal This seems to be fixed in next version as well
  • Very difficult to abstract from your code for testability and for use in multi tiered environments, but it can be done. This can also be classified as the POCO problem that also has been resolved.

There are more, but these are my top ones.

Overall I would use it again, but if you are starting from scratch please save yourself some pain and wait for the latest version or start using the beta if you can.


You might find the walkthroughs for Entity Framework 4.0 useful. All of the new features discussed are annoying emissions from the currently released version for someone.

I found the new TDD/testability features and T4 code generation features especially interesting.


About EF1:

  • Generated SQL is horrible. It multiples joins, it is 10x bigger than it could. I had a simple query, but with a lot of joins and generating this query by EF (not executing) was slowing down significantly my application. No, I couldn't use precompiled query. I used view to cope with it. SQL Profiler was helpful.
  • Primary keys in views are not recognized properly. You have to change edmx file by hand when you import view or doing schema refresh.
  • You can design entities from database in graphical manner, update model from database, but it doesn't always work good, specially when you change field types or foreign keys.
  • You can't update one table in model, always have to update whole model from db.
  • You can't define base class for your entities, it is already defined (EntityObject). You can use interfaces, because classes are defined as partial.
  • No POCO, entity classes are strongly connected to framework.
  • You can set foreign key by EntityReference.EntityKey, but when you have EntityCollection, prepare for round trip to db. Or am I missing something?


I am finding the POCO objects and model-first design in the EF4 beta very sexy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜