EF Core Include Grandchild GenericRepository -


i'm using genericrepository work eager loading on ef core, in case can loading categorianutrientes if try load nutriente

categoriaservice.findby((i => i.categorianutrientes.select(x=>x.nutriente))) 

i've got error:

system.invalidoperationexception: 'the property expression 'i => {from manytomanychild x in [i].manytomanychilds select [x].grandchild}' not valid. expression should represent property access: 't => t.myproperty'. more information on including related data, see http://go.microsoft.com/fwlink/?linkid=746393.'

public class categoria:baseentidadeexecutora {     public int64 id { get; set; }     public string nomecategoria { get; set; }     public int64 qtdeminimarefeicao { get; set; }     public string formacalculo { get; set; }     public int64 necessidadediariaminima { get; set; }     public icollection<categorianutriente> categorianutrientes { get; set; }     public icollection<unidadeensinocategoria> unidadeensinocategorias { get; set; } }  public class categorianutriente : baseentity {     public int64 idcategoria { get; set; }     public categoria categoria {get;set;}     public int64 idnutriente { get; set; }     public nutriente nutriente { get; set; }     public int64 necessidadenutricional { get; set; } }  categoriaservice.findby((i => i.categorianutrientes.select(x=>x.nutriente)))  public ienumerable<t> findby(params expression<func<t, object>>[] includes) {     iqueryable<t> set = entities;      var entity = (includes.aggregate(set, (current, include) => current.include(include)).tolist() ?? default(icollection<t>)); } 


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -