Code: Select all
var job = DB.Jobs
.LoadWith(x => x.Deal)
.LoadWith(x => x.Deal.Status)
.LoadWith(x => x.Status)
.LoadWith(x => x.Cycles)
.LoadWith(x => x.Cycles.LoadWith(c => c.Status))
.LoadWith(x => x.Cycles.LoadWith(c => c.Process))
.Where(x => x.JobNumber == jobNum).FirstOrDefault();
When I use DataLoadOptions as shown below it works fine.
Code: Select all
DataLoadOptions options = new DataLoadOptions();
options.LoadWith<Deal>(x => x.Status);
options.LoadWith<Job>(x => x.Deal);
options.LoadWith<Job>(x => x.Cycles);
options.LoadWith<Job>(x => x.Status);
options.LoadWith<Cycle>(x => x.Process);
options.LoadWith<Cycle>(x => x.Status);
DB.LoadOptions = options;
var job = DB.Jobs.Where(x => x.JobNumber == jobNum).FirstOrDefault();