LINQ to SQL Delay Load Option
By AzamSharp
Views: 434

In this video Mohammad Azam will demonstrate how to delay loading the properties using LINQ to SQL.

class Program
    {
        static void Main(string[] args)
        {
            DiscussionBoardDataContext db = new DiscussionBoardDataContext();

            DataLoadOptions options = new DataLoadOptions();
            options.LoadWith<Post>(p => p.Description);

            db.LoadOptions = options;

            var query = from f in db.Forums
                        join p in db.Posts
                        on f.ForumID equals p.ForumID
                        select p;

            Console.WriteLine(query);            
        }
   
    }

[Play the Video]

 

By AzamSharp


Enter Comment/Feedback
  •  
  •  
  •  
  •  
  •  

Comments/Feedbacks



Join WebHost4Life.com






Copyright GridViewGuy 2007-2008