示例#1
0
 /// <summary>
 /// Gets a key/value collection that can be used to share data within the scope of this request
 /// </summary>
 /// <param name="httpContextAccessor">httpContextAccessor</param>
 /// <param name="loggerFactory">Logger Factory</param>
 public PerRequestCacheManager(IHttpContextAccessor httpContextAccessor, ILiteXLoggerFactory loggerFactory = null)
 {
     _httpContextAccessor = httpContextAccessor;
     _logger = (loggerFactory?.CreateLogger(this) ?? new LiteXNullLoggerFactory().CreateLogger(this));
 }
示例#2
0
 /// <summary>
 /// Ctor
 /// Initializes a new instance of the <see cref="T:LiteX.Cache.SQLite.SQLiteCachingProvider" /> class.
 /// </summary>
 /// <param name="perRequestCacheManager">per request cacheManager</param>
 /// <param name="connectionWrapper">Connection wrapper</param>
 /// <param name="config">Config options</param>
 /// <param name="loggerFactory">Logger Factory</param>
 public SQLiteCacheManager(ICacheManager perRequestCacheManager, ISQLiteConnectionProvider connectionWrapper, SQLiteConfig config, ILiteXLoggerFactory loggerFactory = null)
 {
     if (string.IsNullOrEmpty(config.FileName))
     {
         throw new Exception("FileName is empty");
     }
     if (string.IsNullOrEmpty(config.FilePath))
     {
         throw new Exception("FilePath is empty");
     }
     _config = config;
     _perRequestCacheManager = perRequestCacheManager;
     _connectionWrapper      = connectionWrapper;
     _connection             = _connectionWrapper.GetConnection();
     _logger = (loggerFactory?.CreateLogger(this) ?? new LiteXNullLoggerFactory().CreateLogger(this));
 }