public SmartDbConfiguration() { IEfDataProvider provider = null; try { provider = (new EfDataProviderFactory(DataSettings.Current).LoadDataProvider()) as IEfDataProvider; } catch { /* SmartStore is not installed yet! */ } if (provider != null) { base.SetDefaultConnectionFactory(provider.GetConnectionFactory()); // prepare EntityFramework 2nd level cache ICache cache = null; try { var innerCache = EngineContext.Current.Resolve <Func <Type, SmartStore.Core.Caching.ICache> >(); cache = new EfCacheImpl(innerCache(typeof(SmartStore.Core.Caching.StaticCache))); } catch { cache = new InMemoryCache(); } var transactionHandler = new CacheTransactionHandler(cache); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, new EfCachingPolicy())); } }
public Configuration(IEFRedisCacheSettings efRedisCacheSettings) { bool useRedis = efRedisCacheSettings.UseRedisCache; var redisCon = efRedisCacheSettings.RedisConnectionString; if (useRedis && !string.IsNullOrWhiteSpace(redisCon)) { try { Cache = new RedisCache(redisCon); } catch (Exception) { // eat // throw; } } if (!useRedis || Cache == null) { return; } var transactionHandler = new CacheTransactionHandler(Cache); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, new RedisCachingPolicy())); }
public Configuration() { Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); useRedisCache = Convert.ToBoolean(ConfigurationManager.AppSettings["UseRedisCache"]); Trace.WriteLine("using cache:- " + useRedisCache); if (!useRedisCache) { Logger.Warn("Redis Cache Not Enabled", null); return; } NonEFRedisCache nonCache = new NonEFRedisCache(); if (!nonCache._connectionOutSide.Value.IsConnected) { Logger.Error("No Redis installed or Running", null); return; } var connectionString = new RedisCache("localhost,abortConnect=false,syncTimeout=1000,keepAlive=120"); var transactionHandler = new CacheTransactionHandler(connectionString); AddInterceptor(transactionHandler); var cachingPolicy = new RedisCachingPolicy(); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, cachingPolicy)); }
public CustomConfiguration() { //var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); //AddInterceptor(transactionHandler); //Loaded += // (sender, args) => args.ReplaceService<DbProviderServices>( // (s, _) => new CachingProviderServices(s, transactionHandler, // new CachingPolicy())); // Somehow Custom CachingPolicy not working var tablesToCache = new List <string> { "Aircraft" }; var transactionHandler = new CacheTransactionHandler(WebApiApplication.Cache); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, new CachingPolicySelected())); }
public EntitiesConfiguration() { var transactionHandler = new CacheTransactionHandler(Cache); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>((s, _) => new CachingProviderServices(s, transactionHandler)); }
public CachingConfiguration() { var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); AddInterceptor(transactionHandler); var cachingPolicy = new CusRelCachingPolicy(); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>((s, _) => new CachingProviderServices(s, transactionHandler, cachingPolicy)); }
public Configuration() { CacheTransactionHandler transactionHandler = new CacheTransactionHandler(new InMemoryCache()); this.AddInterceptor(transactionHandler); Loaded += (sender, args) => { args.ReplaceService <DbProviderServices>((s, _) => new CachingProviderServices(s, transactionHandler)); }; }
public Configuration() { var transactionHandler = new CacheTransactionHandler(UnitOfWork.UnitOfWork.Cache); AddInterceptor(transactionHandler); var cachingPolicy = new CachingPolicy(); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>((s, _) => new CachingProviderServices(s, transactionHandler, cachingPolicy)); }
public AppDbConfiguration() { var transactionHandler = new CacheTransactionHandler(new DacheCacheProvider()); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, new DacheCachingPolicy())); }
public CachingConfiguration() { //TODO : Look for a second level cache that works var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, new DefaultCachingPolicy())); }
public EntityConfiguration() { if (!Configuration.Cache.Enabled) { return; } var transactionHandler = new CacheTransactionHandler(_instance.Value); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler)); }
public CachingConfiguration() { //SetExecutionStrategy("System.Data.SqlClient", () => new SqlAzureExecutionStrategy()); var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); AddInterceptor(transactionHandler); var cachingPolicy = new CachingPolicy(); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, cachingPolicy)); }
public RaceAnalysisConfiguration() { SetExecutionStrategy("System.Data.SqlClient", () => new SqlAzureExecutionStrategy()); SetDefaultConnectionFactory(new System.Data.Entity.Infrastructure.LocalDbConnectionFactory("v11.0")); var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, new CachingPolicy())); }
public Configuration() { var redisConnection = ConfigurationManager.ConnectionStrings["Redis"].ToString(); var cache = new RedisCache(redisConnection); var transactionHandler = new CacheTransactionHandler(cache); AddInterceptor(transactionHandler); Loaded += (sender, args) => { args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, new RedisCachingPolicy()) ); }; }
public Configuration() { SetDatabaseInitializer <WindAuth.Data.DataContext>(new MigrateDatabaseToLatestVersion <WindAuth.Data.DataContext, WindAuth.Migrations.Configuration>()); var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); AddInterceptor(transactionHandler); var cachingPolicy = new CachingPolicy(); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler, cachingPolicy)); }
public Configuration() { //var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); //AddInterceptor(transactionHandler); //Loaded += // (sender, args) => args.ReplaceService<DbProviderServices>( // (s, _) => new CachingProviderServices(s, transactionHandler, // new CachingPolicy())); var transactionHandler = new CacheTransactionHandler(Program.Cache); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>( (s, _) => new CachingProviderServices(s, transactionHandler)); }
public BlogDBContextConfiguration() { try { SetProviderServices("System.Data.SqlClient", SqlProviderServices.Instance); CacheTransactionHandler transactionHandler = new CacheTransactionHandler(new InMemoryCache()); AddInterceptor(transactionHandler); CachingPolicy cachingPolicy = new CachingPolicy(); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>((s, _) => new CachingProviderServices(s, transactionHandler, cachingPolicy)); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("+++++ ERROR - Hiba! Hiba a kontextus felépítése közben! " + "Hiba az Adatbázis Modell létrehozása közben! " + $"\tContext Name: {nameof(BlogDbContext)}.\n\n" + $"Exception Message: {ex.Message}"); } }
public ContextConfiguration() { #region cache InMemoryCache cache = null; try { // this fails during a manual migration thus the catch // alternatives are: // 1) use auto-migrations // 2) add a static InMemoryCache and ref. MarketMiner.Data from the client cache = ObjectBase.Container.GetExportedValue <IDataCache>() as InMemoryCache; } catch { cache = new MarketMinerCache(); } var transactionHandler = new CacheTransactionHandler(cache); var cachingPolicy = new MarketMinerCachingPolicy(); AddInterceptor(transactionHandler); Loaded += (sender, args) => args.ReplaceService <DbProviderServices>((s, _) => new CachingProviderServices(s, transactionHandler, cachingPolicy)); #endregion }