Exemplo n.º 1
0
        public virtual void RegisterDependencies(DbgoConfig config)
        {
            var builder = new ContainerBuilder();

            var typeFinder = new WebAppTypeFinder();

            builder.RegisterInstance(typeFinder).As <ITypeFinder>().SingleInstance();

            var drInstances = new List <IDependencyRegistrar>();
            var drTypes     = typeFinder.FindClassesOfType <IDependencyRegistrar>();

            foreach (var drType in drTypes)
            {
                drInstances.Add((IDependencyRegistrar)Activator.CreateInstance(drType));
            }
            //sort
            drInstances = drInstances.AsQueryable().OrderBy(t => t.Order).ToList();
            foreach (var dependencyRegistrar in drInstances)
            {
                dependencyRegistrar.Register(builder);
            }

            var container = builder.Build();

            _containerManager = new ContainerManager(container);
        }
Exemplo n.º 2
0
 public RedisCacheManager(DbgoConfig config, IRedisConnectionWrapper connectionWrapper)
 {
     if (String.IsNullOrEmpty(config.RedisCachingConnectionString))
     {
         throw new Exception("Redis connection string is empty");
     }
     // ConnectionMultiplexer.Connect should only be called once and shared between callers
     this._connectionWrapper = connectionWrapper;
     this._db = _connectionWrapper.GetDatabase();
     //this._perRequestCacheManager = EngineContext.Current.Resolve<ICacheManager>();
 }
Exemplo n.º 3
0
 public void Initialize(DbgoConfig config)
 {
     RegisterDependencies(config);
     RunStartupTasks();
 }
Exemplo n.º 4
0
 public RedisConnectionWrapper(DbgoConfig config)
 {
     this._config           = config;
     this._connectionString = new Lazy <string>(GetConnectionString);
     this._redisLockFactory = CreateRedisLockFactory();
 }