Reputation: 835
I'll have this query in joining the table but it did not returned data from Include table or Join table.
var tasks = (from item in ctx.Tasks
join tp in ctx.TaskPlugins
on item.TaskId equals tp.TaskId
select item)
.Include(x => x.TaskPlugins).Include(x => x.TaskPlugins.Select(p => p.Plugin)).Include(x=>x.TaskPlugins.Select(p=>p.Plugin.Store));
return ctx.Tasks.ToList();
But this query does not return data from TaskPlugins
Error Message: ((System.Data.Entity.DynamicProxies.Task_6F777A6C52D9E84FD3DF53481564A61969CE62ABBA9D985448F99BFB8A49A2D7)new System.Collections.Generic.Mscorlib_CollectionDebugView<oRouter.Model.Task>(task).Items[0]).TaskPlugins
Thanks.
Upvotes: 0
Views: 77
Reputation: 2361
One thing, You should be returning tasks.ToList()
and not ctx.Tasks.ToList()
Second, the last include .Include(x=>x.TaskPlugins.Select(p=>p.Plugin.Store)
is the only one needed. First 2 includes are NOT needed.
Upvotes: 2