Geeks With Blogs


This blog has moved to

 Subscribe in a reader

Add to Google Reader or Homepage

View my teams slideshare
These postings are provided "AS IS" with no warranties, and confer no rights.

IUpdateable has moved to Please visit

ADO.NET Data Service gives you the ability to do:

  • Read/Write with ADO.NET Entity Framework
  • Read only with LINQ to SQL

The reason it is read only for LINQ to SQL is that Data Services needs to object model that it is exposing to implement IUpdatable. LINQ to SQL does not.

There is a solution – you need  implement IUpdatable for LINQ to SQL. This isn’t necessarily as bad as it sounds – if you can narrow down the implementation to how you are using LINQ to SQL.

MikeT had a stab at doing just this back in Dec 2007. The details are wrong (as this was based on a CTP build) – but the essence/approach he used is spot on.

  • The DataContext is a partial class – hence implement a partial class which implements the interface IUpdatable
  • Stub out the 12 methods of IUpdatable (When MikeT did it there were only 7!)
  • Implement the minimum number of methods of IUpdatable you need for your project (e.g. do not implement delete if you never plan to delete). Some debugging will help you identify these.

[EDITED – Mike pointed out he revisited this more recently]

MikeT took an alternative approach in June 2008. He discussed four possible approaches (including the one outlined above) but settled on a slightly more generic approach and included an implementation for the 12 method version of IUpdatable which we ultimately shipped.

The above demonstrates that LINQ to SQL can be used effectively with Data Services. However the better approach IMHO is – switch to the ADO.NET Entity Framework if you plan to use ADO.NET Data Services Read/Write!

Posted on Wednesday, January 21, 2009 5:18 PM .NET 3.5 , Data , Entity Framework , Data Services , Q&A | Back to top

Comments on this post: QandA: How do I use ADO.NET Data Services with LINQ to SQL and enable read/write

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Eric Nelson | Powered by: