Dispelling some urban legends about LINQ to SQL


Scott has a great post where he dispels the following two myths about using LINQ to SQL.

  • LINQ to SQL requires you to start with a database schema.
  • LINQ to SQL requires your classes to implement INotifyPropertyChanged and use EntitySet<T> for any associated collections.

Looking at the post I think he also added in dispelling a third legend, though he didn’t explicitly call it out.

  • LINQ to SQL requires you to use custom attributes in your code and cannot work with a simple poco.  (In other words, LINQ to SQL supports persistance ignorance!)

Personally I have not used LINQ to SQL yet, though I do intend to play with it at some point. I know I have talked to many folks (including friends at Thoughtworks) and I have heard it far easier to grok and use than some other Entity frameworks 🙂

On the intuitiveness said, I am sold. It took me about five minutes of looking at sample code to understand how to use it.

Thanks for this post Scott!

Comments (2)

  1. Jon Limjap says:

    Glenn,

    The POCO argument is something that Jeremy Miller raised against Entity Frameworks:

    http://codebetter.com/blogs/jeremy.miller/archive/2008/05/19/what-dan-simmons-forgot-to-tell-you-about-the-entity-framework.aspx

    Thing is, I also need to see concrete examples of POCO being used vis-a-vis Linq to SQL, perhaps without the attributes that we see automatically generated when doing this by way of following common online examples.

    Any links for exhibiting persistence ignorance with LINQ to SQL?

    Thanks.

  2. Simon Segal says:

    Glenn

    You can find some PI with Linq to SQL info here: <br>

    <a href="http://iancooper.spaces.live.com/blog/cns!844BD2811F9ABE9C!397.entry"/>

    Thanks.