Microsoft joins the Eclipse Foundation and brings more tools to the community

What's wrong with EF?

Off the top of my head...

  1. It pretends that the database is an object-orientated database, instead of a relational database, making for poor access patterns that typically bring back too much data.
  2. It's materializer, the thing that actually maps result sets to objects, is really slow. As in it usually takes longer than executing the SQL itself.
  3. Entities with lazy-loading are bound to the life-cycle of their data context, making them dangerous unless you copy the entity into a normal model object before returning it.
  4. Bulk-loading objects using EF is CPU-bound on just adding them to the data context.
  5. EF purposely makes it difficult to use any database-specific functionality such as full text search.
  6. EF doesn't allow you to cleanly map one class to multiple tables/views. (e.g. Customer mapped to CustomerTable, ImportCustomerView, and sp_GetCustomersWhoOweUsMoney
  7. Likewise, EF makes it painful to map multiple classes to one table. (e.g. CustomerJustNameAndAddress)
  8. EF doesn't support partial updates (e.g. use class CustomerJustNameAndAddress to update just those columns in the customer table)
  9. EF makes logging operations very difficult. Specifically finding out how long each operation takes.
  10. Generally speaking, you can't just update or delete something. Normally you have to do a select first to get an entity, even though you couldn't care less about the data it returns.

What would you use as an alternative?

I have to say Dapper if you want screaming performance.

What I really want to say is Tortuga Chain. It is nearly as fast as Dapper but has a far more powerful SQL generation engine.

I've been using a proprietary version of it for years, but unfortunately I have to rewrite it from scratch in order to open source it. That work is in progress as we speak.

/r/programming Thread Parent Link - blogs.msdn.microsoft.com