Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you think it's advantageous to switch to Entity Framework? [closed]

Tags:

With LINQ to SQL most likely going to not get as much active development as Entity Framework do you think it's best to switch to Entity Framework?

I've personally found EF to be very clunky and hard to use compared to LINQ to SQL which feels very natural.

EDIT: I recently posted an article on my blog about my feelings towards this potential decision...

ADO.NET v LINQ to SQL

like image 365
Chad Moran Avatar asked Nov 09 '08 20:11

Chad Moran


People also ask

Is it good to use Entity Framework?

Entity Framework is the best way to develop database applications. I used to develop my applications using LINQ to SQL but since Microsoft is not going to support it in future, it recommends to use Entity Framework. By the way, Entity Framework 4 in . NET 4 has much better performance than previous versions.

Which of those is a advantage of Entity Framework?

What are the advantages of the Entity Framework? Entity Framework helps to reduce development time and development cost. It provides auto-generated code and allows developers to visually design models and mapping of databases. It allows easy mapping of Business Objects.

Is Entity Framework the best?

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.

Which technique improves the performance mostly in Entity Framework?

The AsNoTracking method tells Entity Framework to stop that additional work and so, it can improve the performance of your application. So, in theory, a query with AsNoTracking should perform better than without.


2 Answers

IMO, not at the moment.

It is clear (from recent announcements especially) that EF is in for some heavy revisions as the "thunderdome" scenario plays out between LINQ-to-SQL and EF. Whatever happens, EF (in a few years) will almost certainly look quite different to EF today. Or certainly "different enough" ;-p

As such, my view is: stick with simple. And simple is LINQ-to-SQL.

I don't see much benefit learning a notoriously complex system if I know it is going to change very soon.

And I'm 100% with you on LINQ-to-SQL ;-p

If I needed something more than LINQ-to-SQL right now, I'd look at NHibernate or maybe LLBLGen Pro.

(edit - as an update, my position has softened a little bit, here and here - but I'm still using LINQ-to-SQL as my primary tool; also - LINQ-to-SQL isn't quite dead yet ;-p).

like image 72
Marc Gravell Avatar answered Oct 11 '22 14:10

Marc Gravell


I've completed a few MVC projects now in production with L2SQL under the hood and found it quite a joy to use. I'm now embarking on a new project and decided to write it using EF and L2EF given the previously cited articles proclaiming the death of L2SQL. After only a couple of days I've decided to go back to L2SQL. Simple things like having to set foreign keys for inserts using either the awful syntax shown below or uneccessary lookups have shocked me.

foo.Foreign_TypeReference.EntityKey =       new EntityKey("DataContextName.Foreign_Type", "Foreign_Type_Id", ForeignTypeId); 

Rather than:

foo.Foreign_Type_Id = ForeignTypeId; 

I don't think it will be that hard to port L2SQL to a future version of EF as L2SQL has a subset of the functionality (though better implemented). The few things that L2SQL has that L2EF doesn't, for example Single() and SingleOrDefault(), can be migrated to EF by creating a few extension methods. I think it will take far less time to get the system running using L2SQL and then port it over later when EF isn't so smelly.

like image 25
LaserJesus Avatar answered Oct 11 '22 13:10

LaserJesus