In this video Mohammad Azam will demonstrate how to delay loading the properties using LINQ to SQL.
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);
}
}