Ramblings of a technology junkie.

ADO.NET EF v LINQ to SQL (take 3)

I come in peace.  This is a post to continue my series about my opinions and thoughts on the issue.  If you haven’t I suggest you go back and read Part 1 and Part 2.

So I’ve been working on a MVC application for a friend of mine and his business.  When I had the meeting with them I originally thought that for the purpose of a retail storefront I would go with ADO.NET EF to give it a really fair trial in the eyes of the jury.

So I started off making some POCO objects so that if I decided to change things up I could do so without having to re-do my whole DAL/BLL.  Shortly after I finished the database setup and the original POCO creation I noticed ADO.NET EF doesn’t support POCO with any ease… fannnnntastic.  After an hour or so of playing with my Rubiks cube I went back to coding, using ADO.NET EF’s code generated objects.  I started to stub out the controllers and write code for adding/removing entities.  It came time to deal with a Product/Category relationship and I realized ADO.NET EF had hidden the CategoryID field on the Product object.  After some digging around I found out you can expose it with some pain and anguish but you can’t even use it to query with.  Mot only that, since I couldn’t even use the CategoryID property on the Product object I decided I would just query for the Category and set the Category property on the Product object.  Guess what – if you have a Product Repository and a Category Repository, you can’t query a Category from one and use it in an object queried from another context.

Here I am, with some code generated objects that I can’t access direct properties of.  I decided to persevere and continue because I really did want to get ADO.NET EF a fair fight.  Knowing I couldn’t access FK properties on objects nor could I set them without having them come from the same context I thought I would try out Stored Procedures… only to find out I couldn’t map them in ADO.NET EF.

At this point I decided to stop, I had wasted almost an entire day moving backwards with productivity for something that should’ve been relatively easy.  They say ADO.NET EF is conceptual mapping which in my opinion should be it would be easier to map things the way you want to without having to bend over backwards, WRONG.  I’ve read that the LINQ to SQL guys have merged with the ADO.NET EF team to bring over some of the features (read: requirements) LINQ to SQL supports.  Hopefully this turns out well.

I really hope those LINQ to SQL guys help out the ADO.NET team because right now ADO.NET EF was a waste of my time.  When v2 comes out if half of these problems still exist I think I’ll be moving to Ruby and Ruby on Rails.  There is a large base of .NET developers moving to the RoR platform and tons of support with books and articles.  We can only hope with that with the new light ASP.NET MVC has shed on ASP.NET that Microsoft will seize this opportunity to show they can do their consumers right.


Stephen Wells said:

I tried EF too and found that as I was working with a database structure that wasnt standard architecture in terms of primary and forein key mappings it didn't work at all.

I think it is geared towards databases that are perfectly simple in their structure.

# January 14, 2009 10:29 PM

Matt Johnson said:

I tried EF as well and got about as far as you did when I decided that nobody in their right mind would use EF.

# January 15, 2009 12:02 AM

Johan said:

I also think EF v1 is truly anoying.. i sincerly hope they do better with v2.

# January 15, 2009 6:58 AM

Xtek said:

Yeah I have hops for v2 since the LINQ to SQL guys went over to that team... here's hoping.

# January 15, 2009 11:09 AM

EFRox said:

It does stink that you can't really work between contexts.  I have instances where I'd like to write queries that join across contexts.

I'm working on a data migration project on a database that has tons of Identity primary key fields.  Using the Entity Framework makes it really easy as all you do is associate it to the parent object and it handles assigning all the keys. Oh and its pretty easy to query on Primary Keys and Foreign Keys, just use the navigation/association in the model?

# January 16, 2009 5:06 PM

seo said:

make sure you tell me a person did not merely start using a wikipedia internet site to verify a degree......

# October 24, 2012 3:53 AM

cheap seo services said:

Zt59N4 I value the blog.Thanks Again. Really Cool.

# October 27, 2012 9:34 PM

Diamantscheiben said:

Im obliged for the post.Really looking forward to read more. Really Great.

# October 31, 2012 11:33 AM

cheap targeted traffic said:

Thanks so much for the blog.Thanks Again. Want more.

# November 1, 2012 10:08 AM

Healing Waters Spa & Cosmetic Clinic said:

I really liked your blog post.Thanks Again. Really Great.

# November 2, 2012 6:59 PM

Healing Waters Spa & Cosmetic Clinic said:

Great, thanks for sharing this blog post.Much thanks again. Great.

# November 2, 2012 10:54 PM

Catheter and Bag Kits and Trays said:

I value the post.Really looking forward to read more. Really Cool.

# November 5, 2012 12:16 PM

boost your bust said:

Hey, thanks for the blog article. Awesome.

# November 5, 2012 12:39 PM