You are trying to migrate from entityframework to core a base Repository class where you have a property that defines the dbset like this:
protected DbSet dBset
{
get
{
return Context.Set<TObject>();
}
}
by implementing the filter method
protected IQueryable Filter(Expression<Func<TObject, bool>> predicate)
{
return dBset.Where(predicate).AsQueryable();
// TODO: Control de excepciones
}
throws error:
'DbSet' does not contain a definition for 'Where' and the best overload of the extension method 'Queryable.Where(IQueryable, Expression>)' requires a receiver of type 'IQueryable'
I don't understand why it doesn't assume the dBset that I defined as a property in this class but when I put the line with
return Context.Set<Tobject>();
with this line the error does not appear, what is happening?
Looking at similar example implementations, such as:
Generic Repository Pattern implemented in .NET Core with EF Core
I don't see that they have a problem, you could see to change, using something like this:
removing the
AsQueryable()
and return the object list with the response of its execution