Difficulty with DataLoadOptions - non deferred loading.
Posted: Mon 14 Jun 2010 17:21
I'm having difficulty loading in a detail table at the same time as master data. If I use the below query using "select c", the detail data is loaded. I can see in the query generated an outer join to the detail table, which is what I want, however whenever I use an anonymous type "select new { c.Data, c.WeekStartDate, c.TimeId, c.DmdbNotes, c.GeographyId, c.CustomerNum, c.Sku };"
the detail table is not loaded and is not part of the query. This query brings in tens of thousands of rows and I only have a small network pipe to send it, so I can't afford bringing all the header data for each of the detail datapoints. I also have to save the data as the users want to access this offline, so I can't use deferred loading either.
using Devart 5.70.140.0
Thank you
the detail table is not loaded and is not part of the query. This query brings in tens of thousands of rows and I only have a small network pipe to send it, so I can't afford bringing all the header data for each of the detail datapoints. I also have to save the data as the users want to access this offline, so I can't use deferred loading either.
using Devart 5.70.140.0
Thank you
Code: Select all
//load notes from the database at the same time we load the other data.
mgr.DataContext.DeferredLoadingEnabled = false;
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith(c => c.CommitmentViews);
dlo.LoadWith(c => c.DmdbNotes);
mgr.DataContext.LoadOptions = dlo;
//get datapoints - detail data
var fd = from c in mgr.DataContext.CommitmentViews.LoadWith(cv => cv.DmdbNotes)
where l.Contains(c.SalesRepId) //u.UserId)
orderby
c.CustomerName, c.CustomerNum,
c.Sku,
c.WeekStartDate
select new { c.Data, c.WeekStartDate, c.TimeId, c.DmdbNotes, c.GeographyId, c.CustomerNum, c.Sku };