Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

.net - Linq 2 SQL or Linq Entities

I am starting to design a new application and what I am wondering is peoples opinions on Linq2SQL or Linq2Entities and what they feel is the better technology for rapid development.

I am also doing some research into ADO.net data services.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Yes, agreed with Slace.

Just be careful on the framework you do choose, to ensure it meets all your needs.

For instance, I recently gutted out Entity Framework from a work project after working with it pretty solidly over the last couple of weeks, as it did not facilitate my needs, mainly due to:-

  1. The things you can't do in Linq to Entities (such as mapping to .net enum types (grr) and the aggravation of receiving 'NotSupportedException' at nearly every turn if you try to get fancy in your linq query statement by calling on function or method calls (see link)).
  2. Lack of native Lazy Loading (I understand there is tools such as EF Lazy LoadGen to facilitate this, but it was not something I wanted to encorporate).

Other than that, commands and the framework seemed straight forward and neat, and the reason I went with EF was:

  1. I believed EF was targeted more for enterprise development and thought L2S was more for hobbyists and was a limited framework. However with further understanding and personally, not needing anything in EF I couldn't do with L2S, I am happy with L2S. Especially if it suits stackoverflow, scalability and efficiency is covered for me.
  2. Option for multiple DBMS' (I'm yet to see this in action however)
  3. It was rumored Microsoft was dropping support and investment on Linq to SQL.
  4. I love the fact you can update tables and DB changes within the EF .edmx without having to delete the existing schema model (which you are forced to do in Linq to SQL). Albeit, not super annoying unless you've customised any properties in your L2S schema (.dbml).

Further reading (another SO post):
Is LINQ to SQL Dead or Alive?

I would love to choose EF, I really do not know what to make of the L2S vs. EF debarcle, and if L2S really is a dead duck, shrug. my main gripe admittedly with EF is the NotSupportedException's - I could get around lazy loading if I could perform method calls in linq without getting this...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...