What is Linq to SQL Deferred Loading?

What is Linq to SQL Deferred Loading?

(C#) -Deferred Loading is a property of Linq to sql, by default it is set true,

Example: Let’s have two tables -

Blogs Table (BlogID ,Blog Name,owner) and Post table ( PostID, BlogID, Title, Body)

To find Name and No’s of posts in each blog-
BlogDataContext ctx = new BlogDataContext( );
var query = from b in ctx.Blogs select b;
foreach (Blog b in query)
{
   Console.WriteLine("{0} has {1} posts", b.BlogName, b.Posts.Count);
}

Output of queries Produce Blog name with no’s of post, But For each Blog
Looping will be occurs (in case long list of blogs) that’s reduces Overall Performance that’s called the Deferred loading.
Write a Program using Skip and Take operators. How can it beneficial for bulky data accessing on page?
“skip” and “take” Operator used for Paging. Suppose we have Customer table of 100 records. To find 10 records by skipping the first 50 records from customer table-
Write a Program for Concat to create one sequence of Data Rows that contains DataTables's Data Rows, one after the other.
Write a Program for Concat to create one sequence of Data Rows that contains DataTables's Data Rows, one after the other.
How can you find average of student marks from student tables (Columns are StudentID, Marks)?
How can you find average of student marks from student tables (Columns are StudentID, Marks)?
Post your comment