I have the Person class that relates to the PersonPhysical and PersonJuridica tables in a one-to-one relationship. In my Person table I have the Field PersonNature where 0 = Individual and 1 = Legal Entity.
A person can be physical or legal and who defines this is the Field Person Nature. Is there a way for me to give an include in the PersonPicture table, only if PersonNature equal 0 and give an include in PersonJuridic only table of PersonNature equal to 1?
public class PessoaRepository : Repository<Pessoa>, IPessoaRepository
{
public PessoaRepository(SistemaComercialContext context)
:base(context)
{
}
public IQueryable<Pessoa> GetAllJoin()
{
return DbSet //DbSet Pessoa
.Include("PessoaFisica")
.Include("PessoaJuridica")
.AsNoTracking();
}
}