Labels

Tuesday, April 29, 2008

LINQ - Delay/Lazy Loading

Hi,

This blog post summarizes the overview of LINQ.

Below are the new features been introduced in Orcas

§ Automatic Properties

§ Object Initializers

§ Collection Initializers

§ Extesnion Methods

§ Lambda Expressions - p => expressions

§ Query Syntax

§ Anonymous Types

§ Var Keyword

These language features help in making query against relational data. This overall querying programming model is called as "LINQ" - which stands for .NET Language Integrated Query.

Delay/Lazy Loading:

· LINQ to SQL enables developers to specify whether the properties (Column Value) on entities should be prefetched or delay/lazy-loaded on first access.

· We can customize the default Pre-Fetch/Delay-Load Rules for entity properties by selecting any entity property or association in the designer, and then within the property-grid set the "Delay Loaded" property to true or false.

· We can also override this via code when we perform LINQ queries on the entity class.

·

Example:

· Picture" column which stores a (potentially large) binary image. Such retrival of the binary image from the database must happen when we are actually using it (and not when doing a simply query just to list the category names in a list).

Reference: http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx

Hope this helps.

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment