views:

337

answers:

2

HI

What are the pros and cons for using ADO.NET entity model as a data layer? And should i use LINQ if i'm going to use this technology?

Thanks

A: 

Here are some pro's about ADO.NET. I've found no cons yet. Edit: and some more about ADO.NET, including cons: Here

About LINQ: no one will force you to use LINQ (except maybe an employer), but it has certainly benefits in combination with ADO.NET. See also: Here.

Sorry for the bunch of links, but it's a lot of text to C/P. Happy reading :).

Webleeuw
I prefere answers of people who used this technologies before and what difficulties they encounter. So i'm more interested in the cons, than in the pros. since the pros are basically RAD.
LolaRun
i think he is talking about the entity framework
Luke101
Ok, that was not exactly clear for me. Entity Framework is not my specialty.
Webleeuw
+2  A: 

First of all: you don't have to use LINQ to use the Entity Framework (EF), but it certainly helps. EF is based upon something the EF team calls Entity SQL, so what really happens when you use LINQ to Entities is that the LINQ expressions are being translated to Entity SQL, which again are translated to whatever SQL dialect your database uses (T-SQL for SQL Server).

Pros and cons for EF is a bit of a controversial subject as most people don't particularly like EF, but I will try to keep it neutral.

Pros

  • Together with LINQ to SQL (L2S), LINQ to Entities (L2E) and EF are currently the best data access API that Microsoft offers. Despite all their shortcomings, they are way better than 'traditional' ADO.NET for most scenarios.
  • While L2S is simpler, L2E has been tagged as the future of Microsoft's data access API, so if you want to stay in the mainstream Microsoft API slipstream, you should use L2E. It doesn't look like L2S will see much new development.
  • EF will receive quite a boost in capabilities and flexibility in .NET 4

Cons

  • Working with EF is hard. It's pretty brittle when it comes to schema changes, and it's a bitch to update it when the underlying schema changes
  • The T-SQL generated by EF is horrible (although this should change in .NET 4)
  • Persistence Ignorance isn't possible (until .NET 4)
  • Lots of LINQ methods are not implemented, so the API is more limited than it looks like.
  • It's not nearly as flexible an API as one could wish

In short, use it if you can use only what's baked into the BCL, or, if you are on .NET 4, give it a try; otherwise, there are better alternatives in the form of open source libraries.

Mark Seemann
Thanks a lot for this informative answer.But i think that it's better not to use EF unless using .Net4. And since it's a brand new, then it's better to wait for people to test it first... the case of all new Microsoft technologies.
LolaRun