DataLoadOption with FetchMode.Join does not seem to be reliably loading child entities. We have a 3 tiered hierarchy: top level of ClientSetup entity with many children Category entities and each Category has many child Action entities. Each level of the hierarchy also has matching text descriptions that can contain one row for each language (typically only English). Setting up the DataLoadOptions looks like this:
DataLoadOptions dataLoadOptions = new DataLoadOptions();
dataLoadOptions.LoadWith(s => s.SetupTexts, FetchMode.Join);
dataLoadOptions.LoadWith(s => s.Categories, FetchMode.Join);
dataLoadOptions.LoadWith(c => c.CategoryTexts, FetchMode.Join);
dataLoadOptions.LoadWith(c => c.Actions, FetchMode.Join);
dataLoadOptions.LoadWith(a => a.ActionTexts, FetchMode.Join);
db.LoadOptions = dataLoadOptions;
db.DeferredLoadingEnabled = false;
var qry = (from s in db.ClientSetups
where s.Setupkey == setupKey
select new
{
ClientSetup = s
});
return qry.FirstOrDefault().ClientSetup;
The immediate children of ClientSetup load fine, but the next level down does not. The “CategoryTexts” don’t load at all – even though there is data in the database. Actions do load.
The strange thing is, if we switch the two lines like so:
dataLoadOptions.LoadWith(c => c.Actions, FetchMode.Join);
dataLoadOptions.LoadWith(c => c.CategoryTexts, FetchMode.Join);
Now CategoryText loads fine and Actions do not.
I used DBMonitor to track what’s generated and all the data is indeed being fetched. It just doesn’t appear to all be making its way into my entity objects.
This sounds like a bug – or am I missing something about how I am coding this?
FetchMode.Join issues with 3-tier hierarchy
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
We have fixed the issue with entity materialization when multiple load options are set. The fix is available in the latest 3.0.5 build of LinqConnect, which can be downloaded from
http://www.devart.com/linqconnect/download.html
(the trial only) or from Registered Users' Area (for users with active subscription only).
For more information about the fixes and improvements available in LinqConnect 3.0.5, please refer to
http://www.devart.com/forums/viewtopic.php?t=22168
http://www.devart.com/linqconnect/download.html
(the trial only) or from Registered Users' Area (for users with active subscription only).
For more information about the fixes and improvements available in LinqConnect 3.0.5, please refer to
http://www.devart.com/forums/viewtopic.php?t=22168