2
And an example of model
:
public class Grupo
{
public int Id {get;set;}
public string Nome {get;set;}
public ICollection<Item> Itens {get;set:}
}
And the items
public class Item
{
publit int Id {get;set;}
public int GrupoId {get;set;}
public string Nome {get;set;}
}
Is there any way I can filter through EF
only groups containing Items ?
Since Items is a Icollection<Item>, I believe you do not have the property
Count
and the MethodCount
can have a cost far above the acceptable in this situation. An Option would be the MethodAny
, however in my view this still a high cost, the best solution in my view would be a Contains, if it is using EF5 or higher.– Tobias Mesquita
@Tobymosque, as you said and well, either Contains or Any gives. Now at the level of best solution I can no longer have good feedback
– CesarMiguel