basically i have 3 tables and those are user,colors and usercolor
tables info
User Tables has fields like -> UserID, UserName
Color Tables has fields like -> ColorID, ColorName
UserColor Tables has fields like -> UserID, ColorID
i have corresponding dbset classes
in my code.
now see the below query where left join is performed among 3 tables in sql and tell me how to write the same equivalent query with EF and LINQ.
select c.ColorID
, c.ColorName
, IsSelected = case when uc.ColorID is null then 0 else 1 end
from dbo.Colors c
left join dbo.UserColor uc on uc.ColorID = c.ColorID and uc.UserID = 1 --leave this in the join or it becomes an inner join
left join dbo.Users u on u.UserID = uc.UserID