/// <summary> /// Provides functionality to evaluate queries against a specific data source. /// </summary> /// <param name="query">The input EF query.</param> /// <param name="cachePolicy">Defines the expiration mode of the cache item.</param> /// <param name="debugInfo">Stores the debug information of the caching process.</param> /// <param name="cacheKeyProvider">Gets an EF query and returns its hash to store in the cache.</param> /// <param name="cacheServiceProvider">Cache Service Provider.</param> public EFCachedQueryable( IQueryable <TType> query, EFCachePolicy cachePolicy, EFCacheDebugInfo debugInfo, IEFCacheKeyProvider cacheKeyProvider, IEFCacheServiceProvider cacheServiceProvider) { CachePolicy = cachePolicy; DebugInfo = debugInfo; CacheKeyProvider = cacheKeyProvider; CacheServiceProvider = cacheServiceProvider; Query = query.MarkAsNoTracking(); _provider = new EFCachedQueryProvider(Query, cachePolicy, debugInfo, cacheKeyProvider, cacheServiceProvider); }
/// <summary> /// Provides functionality to evaluate queries against a specific data source. /// </summary> /// <param name="query">The input EF query.</param> /// <param name="cachePolicy">Defines the expiration mode of the cache item.</param> /// <param name="debugInfo">Stores the debug information of the caching process.</param> /// <param name="cacheKeyProvider">Gets an EF query and returns its hash to store in the cache.</param> /// <param name="cacheServiceProvider">Cache Service Provider.</param> public EFCachedDbSet( DbSet <TType> query, EFCachePolicy cachePolicy, EFCacheDebugInfo debugInfo, IEFCacheKeyProvider cacheKeyProvider, IEFCacheServiceProvider cacheServiceProvider) { CachePolicy = cachePolicy; DebugInfo = debugInfo; CacheKeyProvider = cacheKeyProvider; CacheServiceProvider = cacheServiceProvider; Query = query; var queryable = Query.AsNoTracking().AsQueryable(); ElementType = queryable.ElementType; Expression = queryable.Expression; _provider = new EFCachedQueryProvider(queryable, cachePolicy, debugInfo, cacheKeyProvider, cacheServiceProvider); }