views:

186

answers:

2

We have used Entity Framework on 2 projects both with several 100 tables.

Our experiance is mainly positive. We have had large productivity gains, compare with using Enterprise Library and stored procedures.

However, when I suggest using EF on stackoverflow, I often get negative comments.

On the negative side we have found that there is a steep learning curve for certain functionality.

Finally, to the question: What problems have people had with EF, why do they prefer other ORMS?

+2  A: 

Like you, my experience with the EF is mostly positive. The biggest problem I've had is that very complex queries can take a long time to compile. The visual designer is also much less stable and has fewer features than the framework itself. I wish the framework would put the GeneratedCode attribute on code it generates.

Craig Stuntz
You can precompile complex queries. Take a look at CompiledQuery.
Brad Gignac
Yes, I know. It's really worthwhile if you need to reuse a query, but no faster if you use the query only once.
Craig Stuntz
+2  A: 

I recently used EF and had a relatively good experience with it. I too see a lot of negative feedback around EF, which I think is unfortunate considering all that it offers.

One issue that surprised me was the performance difference between two strategies of fetching data. Initially, I figured that doing eager loading would be more efficient since it would pull the data via a single query. In this case, the data was an order and I was doing an eager load on 5-8 related tables. During development, we found this query to be unreasonably slow. Using SQL profiler, we watched the traffic and analyzed the resulting queries. The generated SQL statement was huge and SQL Server didn't seem to like it all that much.

To work around the issue, I reverted to a lazy-loading / on-demand mode, which resulted in more queries to the server, but a significant boost in performance. This was not what I initially expected. My take-away, which IMHO holds true for all data access implementations, is that I really need to perf test the data access. This is true regardless of whether I use an ORM or SQL procs or parameterized SQL, etc.

NathanAW