How do I modify this join in accordance with a model change involving
inheritance?
I made a change to the model of my project, and there is a join that I
can't seem to figure out how to change in response to the model change.
Here is the original model setup, and the join code:
query = query.Join(db.Reports,
x => new
{
x.SourceUser,
x.TargetUser
},
x2 => new
{
SourceUser = x2.TargetUser,
TargetUser = x2.SourceUser
},
(x, x2) => new { x, x2 }).Where(f => (f.x.SourceUser ==
user)).Select(p => p.x);
The result of this join is that the resulting query provides only the
report relationships that are mutual (as in, both parties have reported
eachother). This join works perfectly fine, until I make the model change.
Here is the new model setup
and here is my attempt at modifying the join code
query = query.Join(db.Reports,
x => new
{
x.SourceUser,
x.TargetReportable
},
x2 => new
{
SourceUser = x2.TargetReportable,
TargetReportable = x2.SourceUser
},
(x, x2) => new { x, x2 }).Where(f => (f.x.SourceUser ==
user)).Select(p => p.x);
This results in the following error:
The type arguments for method
'System.Linq.Enumerable.Join(System.Collections.Generic.IEnumerable,
System.Collections.Generic.IEnumerable, System.Func, System.Func,
System.Func) cannot be inferred from the usage. Try specifying the type
arguments explicitly.
No comments:
Post a Comment