loadoptions

When are records from related tables loaded with LINQ2SQL

Let's say I have two tables: Report Comment And assuming I have a database context: var reports = db.Reports(); How can I make sure all Comments for each report are loaded as well? At this point I want to disconnect from the database but still have access to the comments. (For example:) reports[0].Comments[0].Subject ...

Compiled LINQ query & DataLoadOptions... with a twist!

I know about the method discussed here: Solving common problems with Compiled Queries in Linq to Sql for high demand ASP.NET websites ... but this doesn't work for my situation as i get a : "Setting load options is not allowed after results have been returned from a query." I am using Codesmith PLINQO scripts to generate entities and...

LINQ: Can I load more than one generation of descendants with DataLoadOptions?

I'm using the following DataLoadOptions: DataLoadOptions options = new DataLoadOptions(); options.LoadWith<Family>(f => f.FamilyLanguages); options.LoadWith<FamilyLanguage>(fl => fl.Language); The Family object comes back with a list of FamilyLanguages, but the FamilyLanguages have only got a LanguageID, the Language object is null. ...

Random DataReader errors and thread-specific DataContext allowing for changing DataLoadOptions.

My .NET MVC project has reached the stage of testing with multiple users and I am getting seemingly random errors (from any screen in the site) relating to Linq2Sql DataReader issues, such as: 'Invalid attempt to call FieldCount when reader is closed.' and 'ExecuteReader requires an open and available Connection. The connection's current...