当前位置: 首页>>代码示例>>C#>>正文


C# IAppHost.GetContainer方法代码示例

本文整理汇总了C#中IAppHost.GetContainer方法的典型用法代码示例。如果您正苦于以下问题:C# IAppHost.GetContainer方法的具体用法?C# IAppHost.GetContainer怎么用?C# IAppHost.GetContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppHost的用法示例。


在下文中一共展示了IAppHost.GetContainer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Register

        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<Users.Service>();
            appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
开发者ID:org-itbiz,项目名称:DDD.Enterprise.Example,代码行数:8,代码来源:Plugin.cs

示例2: AfterPluginsLoaded

        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (container.Exists<IpModuleManager>())
            {
                var manager = container.Resolve<IpModuleManager>();

                manager.DeviceStatusChanged += (sender, args) =>
                {
                    var cb = container.Resolve<IParadoxEventCallbacks>();
                    cb.PutDeviceUpdate(args.Device);
                };

                manager.PartitionStatusChanged += (sender, args) =>
                {
                    var cb = container.Resolve<IParadoxEventCallbacks>();
                    cb.PutPartitionUpdate(args.Partition);
                };
            }
            else
            {
                logger.Error("Cannot find Ip Module Manager to register device and partition status changes events for MQTT");
            }
        }
开发者ID:tracstarr,项目名称:ParadoxAlarmControl,代码行数:25,代码来源:MqttPlugin.cs

示例3: AfterPluginsLoaded

        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (container.Exists<IpModuleManager>())
            {
                var manager = container.Resolve<IpModuleManager>();

                manager.DeviceStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}[{2}]", args.Device.Name, args.Device.Status, args.Device.ZoneId);
                    var settings = container.Resolve<SmartThingsSettings>();
                    var cb = new SmartThingsCallbacks(settings);
                    cb.PutDeviceUpdate(args.Device);
                };

                manager.PartitionStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}", args.Partition.Name, args.Partition.Status);
                    var settings = container.Resolve<SmartThingsSettings>();
                    var cb = new SmartThingsCallbacks(settings);
                    cb.PutPartitionUpdate(args.Partition);
                };
            }
            else
            {
                logger.Error("Cannot find Ip Module Manager to register device and partition status changes events for SmartThings");
            }

        }
开发者ID:norm472,项目名称:ParadoxAlarmControl,代码行数:30,代码来源:SmartThingsPlugin.cs

示例4: Configure

 public void Configure(IAppHost appHost)
 {
     var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
     var mySettings = settingsProvider.GetSettings<SmartThingsSettings>();
     var container = appHost.GetContainer();
     container.Register(mySettings);
     container.RegisterAs<SmartThingsCallbacks, IParadoxEventCallbacks>();
 }
开发者ID:norm472,项目名称:ParadoxAlarmControl,代码行数:8,代码来源:SmartThingsPlugin.cs

示例5: Configure

 public void Configure(IAppHost appHost)
 {
     var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
     var mySettings = settingsProvider.GetSettings<ParadoxMqttSettings>();
     var container = appHost.GetContainer();
     container.Register(mySettings);
     container.Register(new MqttClient(mySettings.BrokerUrl));
     container.RegisterAs<MqttCallbacks, IParadoxEventCallbacks>().ReusedWithin(ReuseScope.Container);
 }
开发者ID:tracstarr,项目名称:ParadoxAlarmControl,代码行数:9,代码来源:MqttPlugin.cs

示例6: Configure

        public static void Configure(IAppHost appHost)
        {
            JsConfig.EmitCamelCaseNames = true;

            RedisConfig.AssumeServerVersion = 2821;

            var container = appHost.GetContainer();
            container.Register<IRedisClientsManager>(c =>
                new RedisManagerPool(appHost.AppSettings.Get("redis-server", "127.0.0.1")));
        }
开发者ID:bradparks,项目名称:RedisReact,代码行数:10,代码来源:SharedUtils.cs

示例7: RegisterService

        private void RegisterService(IAppHost host)
        {
            ServiceDiscovery = Settings.GetDiscoveryClient() ?? new ConsulDiscovery();
            ServiceDiscovery.Register(host);

            // register servicestack discovery services
            host.Register(ServiceDiscovery);
            host.GetContainer()
                .Register<IServiceGatewayFactory>(x => new ConsulServiceGatewayFactory(Settings.GetGateway(), ServiceDiscovery))
                .ReusedWithin(ReuseScope.None);
        }
开发者ID:MacLeanElectrical,项目名称:servicestack-discovery-consul,代码行数:11,代码来源:ConsulFeature.cs

示例8: Register

        public void Register(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            container.Register(c => appHost);
            container.Register<IRedisClientsManager>(new PooledRedisClientManager("localhost:6379"));
            container.Register(container.Resolve<IRedisClientsManager>().GetClient());

            var redisVirtualPathProvider = new RedisVirtualPathProvider(appHost);

            container.Register(c => redisVirtualPathProvider);
            container.RegisterAutoWired<RedisVirtualPathProvider>().ReusedWithin(ReuseScope.Default);
            //container.RegisterAutoWiredType(typeof(RedisVirtualPathProvider), ReuseScope.Default);
            //container.AutoWire(redisVirtualPathProvider);
            
            
            var clientManager = container.Resolve<IRedisClientsManager>();
            var redisClient = container.Resolve<IRedisClient>();
            var pathProvider = container.Resolve<RedisVirtualPathProvider>();
            
            ;
        }
开发者ID:ryanhelms,项目名称:ServiceStack.Contrib,代码行数:22,代码来源:RedisVFSFeature.cs

示例9: AfterPluginsLoaded

        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var authEvents = appHost.TryResolve<IAuthEvents>();
            if (authEvents == null)
            {
                authEvents = AuthEvents.Count == 0
                    ? new AuthEvents() :
                      AuthEvents.Count == 1
                    ? AuthEvents.First()
                    : new MultiAuthEvents(AuthEvents);

                appHost.GetContainer().Register<IAuthEvents>(authEvents);
            }
            else if (AuthEvents.Count > 0)
            {
                throw new Exception("Registering IAuthEvents via both AuthFeature.AuthEvents and IOC is not allowed");
            }
        }
开发者ID:dittodhole,项目名称:dotnet-ServiceStack,代码行数:18,代码来源:AuthFeature.cs

示例10: Register

        public void Register(IAppHost appHost)
        {
            var broker = new MemoryServerEventsBroker()
            {
                //Timeout = Timeout,
            };

            var container = appHost.GetContainer();

            if (container.TryResolve<IServerEventsBroker>() == null)
                container.Register<IServerEventsBroker>(broker);

            appHost.RawHttpHandlers.Add(httpReq =>
                httpReq.PathInfo.EndsWith(StreamPath)
                    ? (IHttpHandler)new ServerEventsHandler()
                    //: httpReq.PathInfo.EndsWith(HeartbeatPath)
                    //  ? new ServerEventsHeartbeatHandler()
                      : null);
        }
开发者ID:jklemmack,项目名称:ServerSentEvents4ServiceStack,代码行数:19,代码来源:SimpleServerEventsFeature.cs


注:本文中的IAppHost.GetContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。