ADO.NET Entity Framework or ADO.NET?

Whether EF4 is really ready for production is a bit hard to say since it's not officially been released yet.... but all the preliminary experiences and reports about it seem to indicate it's quite good However: you need to take into consideration what EF is trying to solve; it's a two-layer approach, one layer maps to your physical storage schema in your database (and supports multiple backends), and the second layer is your conceptual model you program against. And of course, there's the need for a mapping between those two layers So EF4 is great if you have a large number of tables, if you have multiple backends to support, if you need to be able to map a physical schema to a different conceptual schema, and so forth. It's great for complex enterprise level applications BUT that comes at a cost - those extra layers do have an impact on performance, complexity, maintainability.

If you need those features, you'll be happy to pay that price, no question. But do you need that? Sure, you could go back to straight ADO.NET - but do you really want to fiddle around with DataTables, DataRows, and untyped Row"RowName" constructs again?

REALLY? So my recommendation would be this: if you need only SQL Server as your backend if you have a fairly simple and straightforward mapping of one database table to one entity object in your model then: use Linq-to-SQL! Why not?

It's still totally supported by Microsoft in . NET 4 - heck, they even did bugfixes and added a few bits and pieces it's fast, it's efficient, it's lean and mean - so why not?

Whether EF4 is really ready for production is a bit hard to say since it's not officially been released yet.... but all the preliminary experiences and reports about it seem to indicate it's quite good. However: you need to take into consideration what EF is trying to solve; it's a two-layer approach, one layer maps to your physical storage schema in your database (and supports multiple backends), and the second layer is your conceptual model you program against. And of course, there's the need for a mapping between those two layers.So EF4 is great if you have a large number of tables, if you have multiple backends to support, if you need to be able to map a physical schema to a different conceptual schema, and so forth.

It's great for complex enterprise level applications. BUT that comes at a cost - those extra layers do have an impact on performance, complexity, maintainability. If you need those features, you'll be happy to pay that price, no question.

But do you need that? Sure, you could go back to straight ADO.NET - but do you really want to fiddle around with DataTables, DataRows, and untyped Row"RowName" constructs again? REALLY?

So my recommendation would be this: if you need only SQL Server as your backend if you have a fairly simple and straightforward mapping of one database table to one entity object in your model then: use Linq-to-SQL! Why not? It's still totally supported by Microsoft in .

NET 4 - heck, they even did bugfixes and added a few bits and pieces - it's fast, it's efficient, it's lean and mean - so why not?

Thanks for the response!. As you said ado. Net is just a pain in the ass , and I really like linq-to-sql but it feels like choosing something that is dieing slowly.

Isn't EF the future? – sharru Mar 15 '10 at 13:15 1 EF is the future - if you need all those features, yes. Linq-to-SQL is available, it's valid, it works, it's fast - why not use it?

– marc_s Mar 15 '10 at 15:33.

My advice is use both. At first I thought I would only use linq to sql and never have to touch ado. Net ever again ( what made me happy lol).

Now I am using both because some things linq to sql(and any ORM like EF) can't do. I had to do some mass inserts and I did it first with linq to sql and to do 500 records it took over 6mins(2 mins for validation rules rest was inserting into the db). I changed it to sql bulk copy and now it is down to 2min and 4 seconds(4 seconds to do all inserts) But like marc_s said I really did not want to fiddle around with DataTables, DataRows, and untyped Row"RowName".

Say my table was like 10 columns long and called Table A. What I did was I used linq to sql and made a Table A class( new TableA()) object and populated it with data. I then would pass this object to a method that created the datarow.So linq to sql saved me some time because I probably would have made a class as I would not have wanted to pass in 10 parameters into the method that makes the data row.

I also feel it gives a bit of typeness back as you have to pass in the right object to use that method so less chance of passing in the wrong data. Finally you can still use linq to sql to call Stored procedures and that is like one line of code.So I would use both when ever you notice that linq to sql (or in your case EF) is slow then just write a SP and call it through EF. If you need to do straight ado.

Net evaluate what you need to do maybe you can use EF for most of the code(so you can at least work with objects) and only for that small portion ado.Net sort of what I did with sql bulk copy.

EF 4 is now more similar to LINQ to SQL, in the good ways; it has the FK keys right in the object, has add methods right in the object sets, and a lot of other nice features. THe designer is much improved, and the major plus is that it works with SQL and Oracle, and maybe some others (as long as the provider supports it) instead of LINQ to SQL with only SQL Server. EF is the future; the ADO.NET data services is a web service add on, plus it supports POCO and T4 generation, and any new features will support this (LINQ to SQL is maintenance only, and data sets won't be getting any changes any more).

HTH.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions