Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 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);
        }