I have 2 Tables AtdDailyAttendance
and AcdAdmissionSessionDetails
. I want to join these 2 tables from linq based on 2 ids, which means in Sql this join looks like
SELECT a.Id, a.DateId,
a.StudentLedgerId, a.AttendanceTypeId,
a.SchoolId, a.UserId, a.SessionId,
d.ClassId,d.MediumId,
d.StreamId, d.ShiftId,
d.SectionId
FROM AtdDailyAttendance a INNER JOIN AcdAdmissionSessionDetail d
ON a.StudentLedgerId = d.StudentLedgerId AND a.SessionId = d.SessionId
But in LINQ I'm unable to do this. I tried this way
var query =
from a in dbCOntext.AtdDailyAttendances
join b in dbCOntext.AcdAdmissionSessionDetails
on a.StudentLedgerId equals b.StudentLedgerId
// on a.SessionId equlas b.SessionId
select new
{
a.AtdSetedDatesForAttendance,
a.DateId,
a.StudentLedgerId,
a.SchoolId,
a.UserId,
a.SessionId,
b.ClassId,
b.SectionId,
b.MediumId,
b.StreamId
}
var liResult = query.ToList();
Here I'm unable to perform join between SessionId
.