Future Query and Cache don't work together

Aug 17, 2016 at 9:15 PM
Hi,
how I can use second level cache with the entity framework extension (Future Query)?
link

With my code if I use the Future() extension the query will never cached.
 public IEnumerable<Service> GetServices(EnumAccountType accountType)
        {
            return UnitOfWork.Context.Services
                                     .Where(s => s.UserTypeId == (int)accountType)
                                     .AsNoTracking()
                                     .Cached()
                                     .Future();

        }
Thnx you
Aug 19, 2016 at 5:40 PM
I don't know what future is, sorry. Because EF Cache works at the provider level I assume it should work if set up correctly unless they are replacing provider services in which case both would have to be registered so that one wraps the other.
Oct 20, 2016 at 3:47 PM
moozzyk wrote:
I don't know what future is, sorry. Because EF Cache works at the provider level I assume it should work if set up correctly unless they are replacing provider services in which case both would have to be registered so that one wraps the other.
From the documentation of the EntityFramework.Extended library
"Build up a list of queries for the data that you need and the first time any of the results are accessed, all the data will retrieved in one round trip to the database server. Reducing the number of trips to the database is a great. Using this feature is as simple as appending .Future() to the end of your queries."

It's implemented in this way
"Future queries work by creating an IFutureQuery object that keeps the IQueryable. The IFutureQuery object is then stored in IFutureContext.FutureQueries list. Then, when one of the IFutureQuery objects is enumerated, it calls back to IFutureContext.ExecuteFutureQueries() via the LoadAction delegate. ExecuteFutureQueries builds a batch query from all the stored IFutureQuery objects. Finally, all the IFutureQuery objects are updated with the results from the query."