What have your experiences been with Entity Framework?

EF has been out for awhile now and I'm considering evaluating it - what have your experiences been?

I am interested in both web and desktop applications, and maybe some comparisons between EF and other ORM tools that you've used.

Learning curve is a factor since there is a team involved. Is this thing a bloated mess, or it is lean and sharp?

I heard that Microsoft is using this internally and in a big way, so that's a good sign. If you have any thoughts about how it might fit into the cloud-based future that MS seems to be spending their money on these days, that might also be interesting. After all, if this is something we might all eventually need to know, that would raise the priority level a notch or two.

Thanks a lot!

Answers


Well, I just finished implementing a complete system in EF, it was my first real experience with the EF in a production environment. The app is running now for about 45 days with 100's of users hitting it daily with no issues.

I think the largest thing is that you have to change your thinking. If you are thinking like a relational database ORM then you already have the wrong mindset. You need to think in terms of partial methods, objects and extentions. Once you get that basic mindset down things start to flow (and you rewrite a lot of code from when you first started).

Getting Help is rough

The other frustrating part of EF is that everywhere you go for help is full of L2S biggots who think they already know everything you need to do and keep trying to tell you to drop it and just use L2S... If I would have ASKED for how to do that in L2S then maybe their opinion would be valid...

EF Works Fine

The basic ability to generate objects that you can then extend through partial methods works well. I actually was pretty frustrated at the early stages because I kept trying to get things the way I would in a SQLCommand. Once you realize you can think in terms of what the business logic needs rather than how SQL works you can get a lot more done.

For example - I kept trying to do joins to get a list of things that were related by a specific FK for various tasks. Once I finally figured out that I can hand the entire where claus to the EF and let figure out how to get the data back to me quickly the code was actually much faster.

Includes stink

The Include syntax feels like a hack to me though. Having to use .Include("TableName.DetailTable") is UGLY. Maybe I am just spoiled by intellisense, but I hate that syntax.

On demand load

Master detail loads are also a bit ugly. If you don't want to include them you can always take their reference and see if it .IsLoaded then call .Load. Why? Can't the object do that for me? I ended up implementing an extention method on my objects that if I try to load a detail class that is not loaded it loads it on demand. Seems like that should have been built in to me.

Note: The detail load of a filtered recordset mentioned in the above post is not complicated, but is not obvious either. You can filter using Lambda expressions.

Do you EVER want to move the project?

Here is the big reason: Non vendor lock-in. If you EVER want to take that code to another database you CANNOT do it with Linq2SQL. There is no provider model. You may have a chance to move an EF system to another vendor. In my case the same project runs on SQL Server and VistaDB EF (Alpha) without code changes. So I can xcopy deploy it, or connect to a server as I choose at runtime.


Need Your Help

Efficient way to tokenize a string - C

c algorithm

I am trying to tokenize a string. I have a table of available tokens ordered in the form of a trie. Each token knows it has children. A simple tokens table will look like,

Clearing and adding list using XSLT

xslt

I have an xml file with the data below: