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


C# TemplateService.CreateChannelManager方法代码示例

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


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

示例1: RegisterServices

        private void RegisterServices()
        {
            var endpoint = loginSettings.Endpoint;

            var serverUserService = new UserService(endpoint);

            Guid sessionId;

            using (var channelManager = serverUserService.CreateChannelManager())
            using (var channel = channelManager.CreateChannel())
            {
                var currentUser = channel.Service.UserLogin(loginSettings.User, loginSettings.Password).Result as Administrator;
                sessionId = currentUser.SessionId;
                Container.RegisterInstance(currentUser);
            }

            Container.RegisterInstance(serverUserService);
            Container.RegisterType<ChannelManager<IServerTcpService>>
                (new InjectionFactory(c => serverUserService.CreateChannelManager(sessionId)));

            var serverService = new ServerService(endpoint);
            Container.RegisterInstance(serverService);
            Container.RegisterType<ChannelManager<IServerTcpService>>
                (new InjectionFactory(c => serverService.CreateChannelManager(sessionId)));

            var queuePlanService = new QueuePlanService(endpoint);
            Container.RegisterInstance(queuePlanService);
            Container.RegisterType<DuplexChannelManager<IQueuePlanTcpService>>
                (new InjectionFactory(c => queuePlanService.CreateChannelManager(sessionId)));

            var templateService = new TemplateService(endpoint);
            Container.RegisterInstance(templateService);
            Container.RegisterType<ChannelManager<ITemplateTcpService>>
                (new InjectionFactory(c => templateService.CreateChannelManager(sessionId)));

            var theme = string.IsNullOrEmpty(portalSettings.Theme)
                ? Templates.Themes.Default : portalSettings.Theme;

            var templateManager = new TemplateManager(Templates.Apps.Common, theme);
            Container.RegisterInstance<ITemplateManager>(templateManager);
        }
开发者ID:breslavsky,项目名称:queue,代码行数:41,代码来源:PortalInstance.cs

示例2: RegisterServices

        private static void RegisterServices()
        {
            serverService = new ServerService(endpoint);
            container.RegisterInstance(serverService);
            container.RegisterType<ChannelManager<IServerTcpService>>
                (new InjectionFactory(c => serverService.CreateChannelManager(sessionId)));

            userService = new UserService(endpoint);
            container.RegisterInstance(userService);
            container.RegisterType<ChannelManager<IUserTcpService>>
                (new InjectionFactory(c => userService.CreateChannelManager(sessionId)));

            templateService = new TemplateService(endpoint);
            container.RegisterInstance(templateService);
            container.RegisterType<ChannelManager<ITemplateTcpService>>
                (new InjectionFactory(c => templateService.CreateChannelManager(sessionId)));

            workplaceService = new WorkplaceService(endpoint);
            container.RegisterInstance(workplaceService);
            container.RegisterType<ChannelManager<IWorkplaceTcpService>>
                (new InjectionFactory(c => workplaceService.CreateChannelManager(sessionId)));

            queuePlanService = new QueuePlanService(endpoint);
            container.RegisterInstance(queuePlanService);
            container.RegisterType<DuplexChannelManager<IQueuePlanTcpService>>
                (new InjectionFactory(c => queuePlanService.CreateChannelManager(sessionId)));

            lifeSituationService = new LifeSituationService(endpoint);
            container.RegisterInstance(lifeSituationService);
            container.RegisterType<ChannelManager<ILifeSituationTcpService>>
                (new InjectionFactory(c => lifeSituationService.CreateChannelManager(sessionId)));

            var theme = string.IsNullOrEmpty(administratorSettings.Theme)
                ? Templates.Themes.Default : administratorSettings.Theme;

            templateManager = new TemplateManager(Templates.Apps.Common, theme);
            container.RegisterInstance<ITemplateManager>(templateManager);
        }
开发者ID:breslavsky,项目名称:queue,代码行数:38,代码来源:Program.cs


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