I have a method that receives a name of either a Group or a User (email) and has to return the Abstract_Entity object of the Group or User.
The MSSQL query seems to work in all cases, but the only time the LINQ query works is when the string is the email of a user.
TranslateUserOrGroup(string name): Abstract_Entity
Do you guys see any difference in the MSSQL query and the LINQ code?
The LINQ query
return (from e in complementCoinsEntities.Abstract_Entity.AsNoTracking()
join eg in complementCoinsEntities.Entity_Group on e.ID equals eg.entityID
join g in complementCoinsEntities.Group on eg.groupID equals g.ID
join u in complementCoinsEntities.User on e.ID equals u.userID
where userOrGroup == u.email || userOrGroup == g.name
select e).SingleOrDefault();
The MSSQL query
select DISTINCT ae.ID
from Abstract_Entity ae
join Entity_Group eg on ae.ID = eg.entityID
join [Group] g on eg.groupID = g.ID
join [User] u on ae.ID = u.userID
where g.name = 'test' OR u.email = 'test'

complementCoinsEntities.Abstract_Entity.Where(x => x.Entity_Group.Group.name == userOrGroup || x.Entity_Group.Group.User.email == userOrGroup).SingleOrDefault();?