voronov-maxim / OdataToEntity

OData .net core
MIT License
153 stars 32 forks source link

Cache does not consider function within $filter #18

Closed techniq closed 6 years ago

techniq commented 6 years ago

If caching is left enabled, calling a query that uses contains, startswith, etc will return the same result set of the initial call.

For example, calling:

http://localhost:5000/odata/Departments?$top=10&$filter=contains(Name,'Admin')

and then calling

http://localhost:5000/odata/Departments?$top=10&$filter=contains(Name,'Information')

will return the same result as the first. If you stop and restart the server, the second result set is then returned (but calling the first will now return the second's, etc)

As a workaround, I've disabled the cache in the data adapter

public class CommonDbDataAdapter : OeEfCoreDataAdapter<CommonDbContext>
    {
        public CommonDbDataAdapter(DbContextOptions options) : base(options, new OeQueryCache(false)) {}
    }
}
voronov-maxim commented 6 years ago

Thanks, this is it was misspelling