Linq unable to hydrate an IEnumerable in a left outer join group by query -
i have left outer join group linq query:
var query = idef in taskdb.taskdefinitions join iparam in taskdb.taskparameters on idef.id equals iparam.taskid nullableparameters iparam in nullableparameters.defaultifempty() join iexecution in executions on idef.id equals iexecution.taskid nullableexecutions iexecution in nullableexecutions.defaultifempty() group iparam new { definition = idef, execution = iexecution } g select new querydomain { definition = g.key.definition, parameters = g, execution = g.key.execution, }; public class querydomain { public taskdefinition definition { get; set; } public ienumerable<taskparameter> parameters { get; set; } public taskexecution execution { get; set; } }
the query keeps throwing
system.data.sqlclient.sqlexception (0x80131904): invalid object name 'dbo.taskparameter'.
i stopped right before execution examine underlying sql statement, reason, doesn't seem select fields table taskparameter
select [t4].* ( select [t0].*, [t3].* [dbo].[taskdefinition] [t0] left outer join [dbo].[taskparameter] [t1] on [t0].[id] = [t1].[taskid] left outer join ( select 1 [test], [t2].* [dbo].[taskexecution] [t2] ) [t3] on ([t0].[id] = [t3].[taskid]) , ([t3].[asof] = @p0) group [t0].*, [t3].* ) [t4] [t4].[cstype] = @p1
i simplified query make easier read.
the sql works, didn't select values taskparameter.
anybody has idea happened?
at end, have 3 tables. taskdefinition main table. taskexecution may contain 0 or 1 entries indexing (fk) taskdefinition. taskparameter may contain number (>=0) of entries indexing (fk) taskdefinition. querydomain reflects desired structure of result of query. thanks.
Comments
Post a Comment