Linq To Sql vs Entity Framework vs Ado.Net sqlserver

 
108   96.6
Jun 07, 2012
 
Can somebody please explain the benefits/drawbacks of L2S, Entity Framework and Ado.Net Sqlserver? I was looking at LingToSql and it looks like a ton of mapping and I thought L2S was supposed to speed that process up but it looks like you have to do another mapper on class on top of the 3 you already have to do. Entity Framework also has a mapper class which is time consuming. I want to use this design for the N-Tier architecture but there is so much mapping that the other developers here are complaining how slow it is and don't see the benefits. From what I can see they are all time consuming.

Thanks
Dennis



50   50
Jun 11, 2012

LinqToSQL will give you a fast way to get started with an ORM but is limited to 1 to 1 mappings.

You should plan to map the CRUD objects into domain objects and pass those objects around in your application.

Following that logic, subsequent investigations will lead you to the Entity Framework as it is more flexible and so gives you more options including support for mapping your CRUD interface into a domain model.

Read this:
http://msdn.microsoft.com/en-us/library/cc161164.aspx

Avoid binding your UI to your database.

The benefits of doing so far out weigh the costs. 

568   99.9
Jun 11, 2012
Dennis,

For either L2S or EF, the only reason you would needed a mapper is if you don't want to reference the System.Data.Entity assembly in your UI project.  There are pros and cons to this. 

Pros
  • No mapping
  • business object models are generated for you by ORM

Cons

  • System.Data.Entity - some teams don't want this in their UI

  • mapping is necessary

Alternative

If you use the DbContext for EF you can use common POCO's and then no mapping is necessary.

You can watch a video where I build an application with this pattern from scratch.  http://www.codegencentral.net/s/59

It's a thought.

King Wilder