I have a Gestor
table in the database where I store information for a user with Manager profile. In this table, I have two FK's
: uniaoId and schoolId . Well, this manager MUST belong to a union and may or may not belong to a school.
That's my problem. At the time I join with linq, it does not bring managers who do not belong to a school. I've tried the following, but it did not work:
var listaRelatorioEmail = (
from ge in db.Gestor
join uni in db.Uniao on ge.UniaoId equals uni.UniaoId into uni_join
from uni in uni_join.DefaultIfEmpty()
join es in db.Escola on ge.EscolaId equals es.EscolaId into es_join
from es in es_join.DefaultIfEmpty()
select new
{
UniaoNome = uni.Nome,
UniaoId = uni.UniaoId,
EscolaNome = es.Nome,
EscolaId = es.EscolaId,
}).ToList();