public void Register(ContainerBuilder builder, IServerSetting setting)
        {
            var redisconfig = setting as IRedisServerSetting;

            if (redisconfig == null)
            {
                return;
            }

            //ConfigurationOptions options = new ConfigurationOptions();
            //foreach (var host in redisconfig.RedisHosts)
            //{
            //    options.EndPoints.Add(host);
            //    options.DefaultDatabase = redisconfig.RedisDb;
            //}

            //Redis连接池  管理全局信息
            builder.Register(c => ConnectionMultiplexer.Connect(redisconfig.RedisHosts))
            .As <ConnectionMultiplexer>()
            .SingleInstance();

            builder.Register(c => c.Resolve <ConnectionMultiplexer>().GetDatabase(redisconfig.RedisDb))
            .As <IDatabase>()
            .InstancePerDependency();

            //在线管理  TODO ,,,,,
            builder.Register(c => new RedisOnlineManager(c.Resolve <ConnectionMultiplexer>()))
            .As <ISessionManager>()
            .SingleInstance();
        }
Beispiel #2
0
        public Smtp(IServerSetting settings, IUserAuthentication user, MimeMessage mimeMessage)
        {
            _client = new SmtpClient();

            _mimeMessage = mimeMessage;
            _server      = settings;
            _user        = user;
        }
        public void Register(ContainerBuilder builder, IServerSetting setting)
        {
            //默认Config内存数据处理器
            builder.Register(c =>
            {
                var newReader = new MemoryConfigReader(
                    c.ResolveKeyed <List <Assembly> >("ConfigAssemblyList")
                    , c.Resolve <IConfigProvider>());

                return(newReader);
            })
            .As <IConfigReader>()
            .SingleInstance();
        }
 public void SetUp(IContainer container, IServerSetting setting)
 {
     container.Resolve <IConfigReader>()?.Load();
 }
Beispiel #5
0
 public MimeService(IServerSetting settings, IUserAuthentication user)
 {
     _mimeMessage = new MimeMessage();
     _client      = new Smtp(settings, user, _mimeMessage);
 }
 public void SetUp(IContainer container, IServerSetting setting)
 {
 }