Why does DeferredLoadingEnabled = false when ObjectTrackingEnabled = false?

MSDN help is the most frustrating creation ever.  Even when it really does answer the “what”, it almost never answers the “why”.  In this case, I’m working with Linq to SQL.  I’m using the repository pattern and passing in a read-only or read-write datacontext depending on the situation.  I’m making a datacontext read-only by setting ObjectTrackingEnabled=false.  Here’s the MSDN article on ObjectTrackingEnabled. http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.objecttrackingenabled.aspx Here is the key sentence: “If ObjectTrackingEnabled is false, DeferredLoadingEnabled is ignored and treated as false. In this case, the DataContext is read-only.” Ok.  I get that ObjectTrackingEnabled=false by necessity makes the context read-only.  After all, if you’re not tracking changes, how do you know what to update?  What I don’t understand is why DeferredLoadingEnabled gets set to false as well?  If I have the following object model: Order –> Status I want to be able to have status lazy load when I do something such as reference the status description, like so: Order.Status.Description <= This *should* lazy load the Status object Why, oh why, can’t I still get lazy loading with a read-only datacontext?  The Status object could simply be loaded with the same read-only context, couldn’t it?  Someone at MS made this decision.  But I have absolutely no idea how to find out the reasoning behind it.  What I do know is that retrieving the status description in the example above has to be written two different ways now depending on my scenario.  Ugly…

John West

John West is an independent technology consultant who specializes in using technology to improve business processes.  That means that technology for its own sake isn't worth much; it's value only comes from helping people do things better, cheaper and faster.

That said, he spends way too much time testing cutting-edge gadgets that often come with promises of making things better and faster, but often fail to live up to those promises.  And they usually fail on the cheaper front as well.

Month List

Page List