-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi
The extension methods seems to work only for properties of type DbSet but not on any methods having similar signature
Error message:
QueryableValues only works on a DbContext with at least one public DbSet<> or IDbSet<>.
As per source code
Usage exemple:
var codes = this.dbContext.AsQueryableValues(searchParameter.MyCodes);
this.dbContext.Set<MyEntity>().AsQueryable().Where(e => codes.Contains(e.Code)));
Could the extension work with EF6 methods returning DbSet<> as well ?
Or any advise ?
Something like this in DbSetByDbContextFactory
var entityType = this.dbContext.GetType()
.GetMethods()
.Select(i => i.ReturnParameter.ParameterType)
.Where(i => i.IsGenericType && isDbSet(i.GetGenericTypeDefinition()))
.Select(i => i.GenericTypeArguments[0])
.FirstOrDefault();
Metadata
Metadata
Assignees
Labels
No labels