I'm trying to perform a left outer join request with EF7 (7.0.0-rc1-final), vNext RC1 (rc1-final) and SQL Server 2014
Database :
Pet: Id, Name
User: Id, Name, #PetId
This one works:
var queryWorks = from u in _context.Users
join p in _context.Pets on u.PetId equals p.Id into pp
from p in pp.DefaultIfEmpty()
select new {
UserName = u.Name,
Pet = p
};
but this one doesn't work (Message = "Sequence contains no elements"):
var queryFails = from u in _context.Users
join p in _context.Pets on u.PetId equals p.Id into pp
from p in pp.DefaultIfEmpty()
select new {
UserName = u.Name,
PetName = (p == null ? "NULL" : p.Name)
};
SQL Server Profile 2014 shows me that the second request is not sent to the SQL Server. Why ?