0
I need to make a Join between the person and people tables so that the core Entity Framework brings a corresponding record. Let me be clearer:
In the personal tableentity, I sort my register of people using an Enum. I did this to save the Ids of each registration (Person, Customer, supplier, etc). If a person is a customer they will have an ID, if they are a Supplier they will have another ID and if they are neither, they will have their ID.
At the moment, I need to get in the bank and bring all the people who are physical/legal and who are PERSON type.So I need to give a Join in the Personal table entity and do a Where informing to bring only type 0 - PERSON. How do I do this using LINQ?
public IQueryable<Pessoa> GetJoinAll()
        {
            var pessoas = Db.Pessoa
                .Include("PessoaEntidade")
                .Include("Filial")
                .ToList();
            pessoas.ForEach(x =>
            {
                if (x.PessoaNatureza == PessoaNatureza.Fisica)
                {
                    Db.Entry(x)
                        .Reference(f => f.PessoaFisica)
                        .Load();
                }
                else
                {
                    Db.Entry(x)
                        .Reference(j => j.PessoaJuridica)
                        .Load();
                }
            });
            return pessoas.AsQueryable();
        }

after last include use . Where(x => x.PersonalEntitytype == 0). toList();
– Marco Souza
Relacionado https://answall.com/q/82752/101 e https://answall.com/q/153264/101 e https://answall.com/q/184843/101 e https://answall.com/q/182176/101 e
– Maniero