Как я могу передать объекты типа IIncludableQueryable
объекту DbSet<>
? Тип IQueryable
работает, но не IIncludableQueryable
, при использовании Include
и ThenInclude
,
Метод испытаний должен принимать связанный элемент IIncludableQueryable
(.Include().ThenInclude()
).
Тест :
public IQueryable<TEntity> Test<TEntity>(DbSet<TEntity> dbSet, Expression<Func<IIncludableQueryable<TEntity, object>>> query) where TEntity : class => dbSet.Include(query);
Пример звонящего :
return Test<Site>(dbSet, .ThenInclude(app => app.Client)
.ThenInclude(cl => cl.Country)
.ThenInclude(co => co.Culture)
.Include(st => st.App)
.ThenInclude(app => app.ServiceType)
.Include(st => st.CORSEntries)
.Include(st => st.DataConnection)
.Include(st => st.Features)
.ThenInclude(ft => ft.Cultures)
.ThenInclude(clt => clt.Culture)
.Include(st => st.MetaEntries)
.ThenInclude(mt => mt.Culture)
.Include(st => st.Views)
.ThenInclude(vw => vw.MetaEntries)
.ThenInclude(mt => mt.Culture));