VahidN / EFSecondLevelCache.Core

Entity Framework Core Second Level Caching Library
Apache License 2.0
326 stars 50 forks source link

Support order by? #54

Closed johnkwaters closed 5 years ago

johnkwaters commented 5 years ago

I tried plugging in your cache, but I get this when i do an order by:

Unable to cast object of type 'EFSecondLevelCache.Core.EFCachedQueryable`1[MontagePortal.DTO.Base.CrmRefDTO]' to type 'System.Linq.IOrderedQueryable

VahidN commented 5 years ago

Yes, It does. Follow these samples.

johnkwaters commented 5 years ago

So Cacheable has to come after OrderBy? In my case I don't want that. I want the client to be able to sort the cached results as they see fit.

Here is my scenario: I have some smallish tables (100s or rows) that are expensive to fetch from the DB, so I want to cache them in memory. However, I still want the client query to my API to be able to search and sort this full cache of the backing table (in memory).

So I am looking to take all the rows, put them in the cache, and then use the cached data instead of the underlying table, using the same kind of querying as I could a real table.

I was hoping your abstraction behaved like the EF inteface, so I could do things like OrderBy, Skip, Take, ProjectTo and a Where on the projection.

VahidN commented 5 years ago

No. It's a LINQ to Entities cache only, not LINQ to Objects.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.