Delay Loaded Property

I recently discovered while playing with the linq OR designer that each property on a class has a property called DelayLoaded. It allows you to delay the loading of that column from the database until the user accesses that property on the object. Only when you access that property is when linq to SQL server makes a fetch to the database to get that column value. It comes handy in scenarios where you storing XML data type or pictures in a database column which you don't really need until user request for the data. Here is how the screen shot looks like.

image

 

By default the Delay Loaded is set to false which means as soon as this object is retrieved from the database, all the columns will be fetched for that record in the table. When you set the Delay Loaded to True, linq to SQL provider only fetches columns which are marked as Delay Loaded = False.

Published Sunday, April 20, 2008 4:50 PM by zhirani

Comments

# re: Delay Loaded Property

Wednesday, December 3, 2008 6:25 AM by Roman

Thanks! A REALLY useful feature.

Using 2.0 I had to write additional data logic for this! )