I think this is a timely question, since I was interested in the same thing. I am trying to create a serious model of e-commerce, and I am trying to get my POCOs to get rid of persistence problems and also try to stay true to Domain Driven Design. So far, I am very careful, and I am on the fence about whether I should jump from a ship in NHibernate. The only thing that keeps me from doing this is that I assume that Microsoft will improve (and quickly).
Some of the biggest problems so far are:
- Inability to precisely control the materialization of an object. EF calls the zero-arg constructor on your POCO, and you cannot change this behavior.
- No enumeration support. The community screamed - screamed! - for this, and this did not happen. Workarounds are terrible and pollute your domain model.
- Strange display errors when trying to manage column names and relationships in a database. The main ones that I can think of are complex keys and many-to-many relationships. They can be circumvented, and I assume that they will be fixed by the time of release, but nevertheless they disappoint.
- Bad SQL. I also work with DBA, and the SQL that generates EF (with or without Code-First) is terrible.
And that’s just the tip of the iceberg: I’m just starting to learn EF4, and I’m running into terrible roadblocks. As I think of other reasons, I will add them here. I'm still fighting for it.
(I wonder if the community will give another vote “without confidence.”)
More details:
- To add to the problem of “Weird mapping bugs”: you cannot control the column name if it is involved in self-reference (for example, if you have a hierarchy). I assume this will be fixed in the final version.
- Lack of batch processing, which leads to many database calls. For example, how do you delete a bunch of items from a collection? Load all objects into memory and delete them one at a time. A smaller problem is the number of database accesses when pasted into tables that are involved in relation to inheritance.
- There is no reasonable way to deal with model changes. EF Code-First loves to completely drop your entire database if you need to change the schema.
- Multiple extensibility points. You can literally count, on the one hand, the number of events that EF4 allows you to subscribe to (and Code-First does not provide much more).
anon
source share