/// <summary>
 /// Provides functionality to evaluate queries against a specific data source.
 /// </summary>
 /// <param name="query">The input EF query.</param>
 /// <param name="saltKey">If you think the computed hash of the query is not enough, set this value.</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,
     string saltKey,
     EFCacheDebugInfo debugInfo,
     IEFCacheKeyProvider cacheKeyProvider,
     IEFCacheServiceProvider cacheServiceProvider)
 {
     _query    = markAsNoTracking(query);
     _provider = new EFCachedQueryProvider <TType>(_query, saltKey, 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="saltKey">If you think the computed hash of the query is not enough, set this value.</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,
     string saltKey,
     EFCacheDebugInfo debugInfo,
     IEFCacheKeyProvider cacheKeyProvider,
     IEFCacheServiceProvider cacheServiceProvider)
 {
     SaltKey              = saltKey;
     DebugInfo            = debugInfo;
     CacheKeyProvider     = cacheKeyProvider;
     CacheServiceProvider = cacheServiceProvider;
     Query     = query.MarkAsNoTracking();
     _provider = new EFCachedQueryProvider <TType>(Query, saltKey, debugInfo, cacheKeyProvider, cacheServiceProvider);
 }
Example #3
0
 /// <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;
     _provider = new EFCachedQueryProvider <TType>(Query, cachePolicy, debugInfo, cacheKeyProvider, cacheServiceProvider);
 }
Example #5
0
 /// <summary>
 /// Provides functionality to evaluate queries against a specific data source.
 /// </summary>
 /// <param name="query">The input EF query.</param>
 /// <param name="saltKey">If you think the computed hash of the query is not enough, set this value.</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,
     string saltKey,
     EFCacheDebugInfo debugInfo,
     IEFCacheKeyProvider cacheKeyProvider,
     IEFCacheServiceProvider cacheServiceProvider)
 {
     SaltKey              = saltKey;
     DebugInfo            = debugInfo;
     CacheKeyProvider     = cacheKeyProvider;
     CacheServiceProvider = cacheServiceProvider;
     Query     = query;
     _provider = new EFCachedQueryProvider <TType>(Query, saltKey, 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);
        }