I would like to perform a generic search like this:
var table = context.GetCollection<T>();
var query = table.Query();
if (typeof(INamedItem).IsAssignableFrom(typeof(T)))
{
var myItems = query as ILiteQueryable<INamedItems>;
// now run a filter on the ILiteQueryable<INamedItem>
query = myItems as ILiteQueryable<T>;
}
But, myItems is always null. I've been using the same approach with EFCore (where I work with IQueryable<T> instead of ILiteQueryable<T>) - what do I need to do do get a properly typed ILiteQueryable so I can use Linq syntax to run queries rather than to have to write BSonExpressions?
I would like to perform a generic search like this:
But,
myItems
is always null. I've been using the same approach with EFCore (where I work withIQueryable<T>
instead ofILiteQueryable<T>
) - what do I need to do do get a properly typed ILiteQueryable so I can use Linq syntax to run queries rather than to have to write BSonExpressions?