c# - LINQ Join with multiple or conditions -
my question similar question linq join multiple conditions in on clause , other similar question either talk having properties map respective conditions or writing query without join
from t1 in projects t2 in tasks.where(x => t1.projectid == x.projectid && x.completed == true) .defaultifempty() select new { t1.projectname, t2.taskname }
suppose if go first way of writing i.e.
on new { t1.projectid, secondproperty = true } equals new { t2.projectid, secondproperty = t2.completed } j1
that gets converted , (&&). want or (||) in join form (2nd way of writing).
thanks in advance.
if want perform join projectid
, have ||
on secondproperty
must join 1 field , add where
clause:
from t1 in projects join t2 in tasks on t1.projectid equals t2.projectid t1.secondproperty || t1.secondproperty == t2.completed select new { t1, t2 }
wiki
Comments
Post a Comment