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.

1 Comment

Comments have been disabled for this content.