'c# mongodb filter definition inject

I have a scenario where I can either query data from a cache or mongo db. I initially wrote the predicate as FilterDefinition<T>, now I want to use it to filter the cached data using linq.

I tried the following cachedData.AsQueryable().Where(e => filterDef.Inject()), but I get an exception:

System.InvalidOperationException: The LinqExtensions.Inject method is only intended to be used in LINQ Where clauses.

What does this error mean? Am I misunderstanding what this api does?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source