In my Web API project I have this query which joins 2 table (Table1 and Table2) and return a DTO variable:
int my_id=1;
var sample = db.Table1.Where(s1 => s1.Id == my_id)
.Join(db.Table2, s1 => s1.Id, s2 => s2.id_s1,
(s1, s2) => new sampleDTO()
{
User_Id = s1.User.Id,
ProdId = s2.ProdId
}));
Now I would like to join also Table3 which joins with Table1 and add parameters to existing "sample" variable.
I have tried to add a Join clause after the code above but doesn't work, so I have tried to create a new DTO variable with Join clause with Table1 and Table3 and than merge the 2 variables but doesn't work.
Any ideas? Thanks.