/// <summary>
 /// Initializes a new instance of the <see cref="CachedRepository{T}"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 public CachedRepository(DbContext context, int cacheInterval = DefaultCacheIntervalInMinutes) :
     base(context)
 {
     _cacheIntervalInMinutes = cacheInterval;
     _cacheKey         = string.Format(CacheKeyTemplate, typeof(T).Name);
     _cachedDataSource = new CachedDataSource(MemoryCache.Default);
 }
Exemple #2
0
        private CachedDataSource CacheDataSource(Culture culture, DataSource dataSource)
        {
            CachedDataSource cachedDataSource = new CachedDataSource();

            cachedDataSource.DataSourceId    = dataSource.Id;
            cachedDataSource.CSharpClassName = dataSource.CSharpClassName;
            cachedDataSource.Parameters      = dataSource.Parameters;
            cachedDataSource.Code            = dataSource.Code;
            return(cachedDataSource);
        }