I was catching up with the ASP.NET Dynamic Data controls that will ship with the upcoming ASP.Net extension pack, and it struck me that this is a framework that, much like LINQ to SQL, is excellent for writing demo applications. Without writing too much code, you can very quickly create something that looks and even acts like a ‘real’ application.
Here’s the thing: I don’t get paid to write demos. Any real merit I get from any framework is if it helps me build ENTERPRISE applications.
Don’t get me wrong, I absolutely love LINQ, and some of the new language enhancements that have come with it. These days when I’m working in a team using Visual Studio 2005 I hate not being able to use LINQ, object initializers, automatic implemented properties and the like.
Looking at LINQ to SQL though, it seems to have been designed without focus on how you would actually use this in a multi-layer environment. Sure, you can use it to replace your Data Access Layer, but the passing around of data classes using Attach leaves a lot of plumming to be done manually and the whole ‘replay your changes, then submit’ feels awkward at best and looks to have been put in almost as an afterthought.
I understand that the design goal of Persistence Ignorance prevent any persistence plumming in the objects themselves. I am probably a heritic in the eyes of OO-purist, but I care more about productivity then about my objects qualifiying as POCO. It would be nice if a framework like LINQ to SQL would offer you a choice to go the POCO route, or actually have some persistence coding that would take care of change tracking over data tiers. Datasets, spawn of the devil they may be, have a convenient DiffGram model that allows one to pass changes to data over tiers. If a persistence framework can solve this for you, it would make life much easier. LLBL Gen has it. Can we not have something in LINQ to SQL (or the Entity Framework!) that would allow one to choose how to handle change tracking?
Dinesh has written about the design goals of LINQ to SQL. What’s interesting is that he says in this post:
we don’t yet have a simple roundtripping and change tracking on the client.
(Emphasis mine) So it would seem they have given it some consideration, but must have decided to keep it clean and simple, and left it out. Will we see some enhancements in this area for LINQ to SQL? Matt Warren has posted a reply to this forum post:
There is also a technology in the works that automatically serializes LINQ to SQL objects to other tiers, change tracks and data binds the objects for you on that tier and serializes the objects back, solving the cyclic reference serialization problem and the indescribable schema problem for objects with change sets
Further on Matt describes how the Attach method was enhanced so that you can include the old version and new version of an entity object. The ‘technology in the works’ however is more like the tidbits that have come out regarding a mini-connectionless DataContext . Matt has written here that it was not implemented …for lack of time.
I have found no information on when (or if) this will be available.







I had been trying to figure out where all the change tracking was located in linq, i guess there isnt any. I had assumed (yeah, those darn assumptions) that since datasets had change tracking, linq to SQL would of course have it! Thanks for the info!
Comment by TechSaint — March 26, 2008 @ 3:18 pm |
Hi TechSaint,
It’s not fair to say there isn’t any change tracking. There’s actually excellent change tracking, if you stay within the tier your datacontext lives. It’s on the datacontext that all changes are recorded, and typically if you want to push your data classes out across a tier boundary, you’d disconnect them from the datacontext and therefore lose change tracking.
regards, Freek
Comment by Freek Leemhuis — March 27, 2008 @ 7:13 am |