What is wrong in this query? It's about 2 entities that can be logically deleted by inserting a delete date. So I must be sure I get a single Entity with is collection of SubEntities. All with DateDelete not null.
return DbContext.Entity
.AsNoTracking()
.Include(y => y.SubEntities.Select(sb => sb.DateDelete == null))
.Single(y => y.Name == entityName && y.DateDelete == null);
On runtime I get an exception
The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties. Parameter name: path
I also tried this with same error
return DbContext.Entity
.AsNoTracking()
.Include(y => y.SubEntities.Where(sb => sb.DateDelete == null))
.Single(y => y.Name == entityName && y.DateDelete == null);