I would like to return an object with your children, but only wanted to bring the children that corresponded to a certain condition. ex: I have the following classes:
public class Fornecedor
{
public int FornecedorID { get; set; }
public string CnpjCpf { get; set; }
public string RazaoSocial { get; set; }
public virtual ICollection<FornecedorContato> FornecedorContato { get; set; }
}
public class FornecedorContato
{
public int FornecedorContatoID { get; set; }
public int FornecedorID { get; set; }
public bool Ativo { get; set; }
}
In case you would like within the FornecedorContato
list of Fornecedor
, return only elements that are Ativos
How could I do this in a linq?