本文整理汇总了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);
}
示例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);
}