I wrote the inner join for this C# lambda expression but i cant figure out the code for left outer join, here is the code for the inner join...
public List<Server> GetServerResponse()
{
try{
return _serverRepository.FilterBy(x=>x.IsActive && x.IsDashboardVisible).Join(_ServerHelperRepository.FilterBy(x=>x.type == Constants.ServerType), a => a.ServerID, b => b.ServerID, (a,c)=> new Server
{
OpeningCode = a.OpeningCode,
ClosingCode = a.ClosingCode,
OpeningThirdPartyCode = a.OpeningThirdPartyCode,
ClosingThirdPartyCode = a.ClosingThirdPartyCode,
AuditHistory = _auditTrailRepository.FilterBy(x=>x.ElementType == Constants.OutageType && x.ElementId == o.RequestId).OrderBy(z=>z.Id).ToList()
}).OrderBy(Server=>Server.Name).ToList();
}
catch{
(Exception ex) { return new List<Server>();}
}
}
This works perfectly but i cant seem to write it as left outer join