Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thoughts on Entity Framework

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?

like image 918
Jiyosub Avatar asked Dec 08 '08 02:12

Jiyosub


People also ask

Is Entity Framework a good idea?

Conclusion. EF should be considered a great ORM framework which allows faster development, easier and quicker operations to the DB, as long as you are careful and know how it works in order to avoid certain mistakes and create performance problems.

Why we should use Entity Framework?

The Entity Framework enables developers to work with data in the form of domain-specific objects and properties, such as customers and customer addresses, without having to concern themselves with the underlying database tables and columns where this data is stored.

Why you should not use Entity Framework?

One of the biggest reasons not to use Entity Framework Core is that your application needs the fastest possible data access. Some applications do a lot of heavy data operations with very high-performance demands, but usually business applications don't have that high of a performance demand.

What is the performance of Entity Framework?

Entity Framework is an ORM tools. It is good for data accessing. It provides lot of benefits. But for the development of enterprise applications we should consider its performance.

Is Entity Framework good for data access?

API WCF Web API Web Service InterviewShow sub menu Interview General Entity Framework Advantages and Disadvantages of Entity Framework by Rashedul AlamSeptember 5, 2013September 28, 2020 Entity Frameworkis an ORM tools. It is good for data accessing. It provides lot of benefits.

What happens when you define navigation property virtual in Entity Framework?

Reply Lakshmansays: November 9, 2019 at 11:00 pm nice points Reply Akansha Yadavsays: April 29, 2020 at 1:37 pm hey, If you define your navigation property virtual, Entity Framework will at runtime create a new class (dynamic proxy) derived from your class and uses it instead of your original class.

What is lazy loading in Entity Framework?

This new dynamically created class contains logic to load the navigation property when accessed for the first time. This is referred to as “lazy loading”. It enables Entity Framework to avoid loading an entire tree of dependent objects which are not needed from the database. Reply


2 Answers

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...

like image 80
Marc Gravell Avatar answered Oct 10 '22 02:10

Marc Gravell


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).

like image 36
Giovanni Galbo Avatar answered Oct 10 '22 00:10

Giovanni Galbo