Thoughts on Entity Framework

2020-06-04 03:10发布

问题:

I was wondering what people thought about the decision to support Entity Framework over LINQ-to-SQL? I have an application I'm developing originally in LINQ-to-SQL. I found it the perfect solution for our application.

While attempting to port to Entity Framework I was surprised how rough it was. IMHO, not even close to being ready for prime time. No lazy loading, no POCOs, horrible dependency on inheritance. I found it largely unusable in my case and instead decided to stick with LINQ-to-SQL until somehow this Entity Framework can get more polished.

Anyone else have similar experience with it?

回答1:

That is pretty much my view. See my previous reply here. This other question wasn't specifically about the problems in EF, but yes: it has a fair few glitches. For example (in addition to your existing options):

  • no support for Expression.Invoke (re-using expression trees to form a more complex expression)
  • no support for table-UDFs, which can be used to create well-defined, callable methods in the database that are still composable with sort/skip/take etc

LINQ-to-SQL handles both just fine...



回答2:

I think it depends on the application platform. When my team set out to create a new ASP.net app, we wanted to go with EF... but after playing around with it for a bit, we went with Linq-To-SQL. In a web environment, managing the L2S datacontext was a lot easier. Also, we liked that L2S entities expose the original Id field (e.g. EmployeeTypeId), unlike EF, which would only have the child entity exposed. In a web environment, a lot of times you really don't need that extra information, the Id is enough because it is a reference to a dropdown list that has already been loaded (and probably cached).



回答3:

L2S is more mature for what it is made for.

And I will still consider EF as a BETA realease.

there is lot of discussion around EF, you can find alot more in related questions.



回答4:

I've heard that L2S is quickly going the way of the dodo. There is a little bit of chatter about a move to opensource - but the ADO.NET group at Microsoft is planning to push all their efforts towards EF...

Sad too, because I find Linq2SQL extremely easy to work with and the thought of porting all my code makes me a little sick.

Update on LINQ to SQL and LINQ to Entities Roadmap



回答5:

I agree. There are too many bugs and design flaws in Entity Framework v1 (the .net 3.5 SP1 version) to make it usable in real-world development. EFv4 looks more promising though...