My table structure looks like :
Account
AccountId
LoginName
EmployeeId - nullable
Employee
FirstName,
SecondName,
etc..
I have query :
var data = from o in _accountRepository.AsQueryableWithIncludes(x => x.Employee, x => x.Permissions)
select new AccountGridVM
{
AccountId = o.AccountId,
EmployeeFirstName = o.EmployeeId == null ? String.Empty: o.Employee.FirstName,
LoginName = o.LoginName,
Permissions = o.Permissions.Select(s => s.NameCZ)
};
return View(new GridModel { Data = data });
My problem is in tenar operator in EmployeeFirstName, entity framework always fetch only accounts, which has employeeId assign, but i need fetch all accounts.
If i remove EmployeeFirstName propeprty, ef fetch all rows.
Where is problem?
Thanks