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


C# EntityManager.GetHubsByGateway方法代码示例

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


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

示例1: Initialize

        private void Initialize()
        {
            EntityManager em = new EntityManager();
            List<Hub> hubs = em.GetHubsByGateway(ObjectID);
            foreach (var hub in hubs)
            {
                List<HubService> spokes = em.GetSpokesByHub(hub.HubId);
                //ServiceHost host =
                //     CreateServiceHost<TetsuoHubService>("Tetsuo.Core.Contracts.IRouteDispatcher", hub.HubName + ".request");
                //(host.SingletonInstance as TetsuoHubService).SetObjectID(Common.InstrumentationSources.Hub, hub.HubId);
                Instrument(Common.TransmissionStatusCodes.SVC_START, "Starting hub " + hub.HubName, Common.InstrumentationSources.Hub, hub.HubId);

                spokes.ForEach(spoke =>
                {
                    string qName = string.Format(@"{0}\private$\{1}.{2}.request",Environment.MachineName,
                        hub.HubName,spoke.HubServiceName);
                    if(!(MessageQueue.Exists(qName)))
                        MessageQueue.Create(qName,true);
                    ServiceHost spokeHost =
                     CreateServiceHost<TetsuoHubService>("Tetsuo.Core.Contracts.IRouteDispatcher", hub.HubName + "." + spoke.HubServiceName + ".request");
                    //spokeHost.AddServiceEndpoint(spoke.SpokeContract, new MsmqIntegrationBinding(), @"msmq.formatname:DIRECT=OS:.\private$\" + hub.HubName + "." + spoke.SpokeName + ".request");
                    (spokeHost.SingletonInstance as TetsuoHubService).SetObjectID(Common.InstrumentationSources.Spoke, spoke.HubServiceId);
                    Assembly asm = Assembly.LoadFrom(spoke.HubServiceAssembly);
                    if (!(spokeHost.SingletonInstance as TetsuoHubService).Assemblies.Contains(asm))
                        (spokeHost.SingletonInstance as TetsuoHubService).Assemblies.Add(asm);
                    (spokeHost.SingletonInstance as TetsuoHubService).HostedContract = asm.CreateInstance(spoke.ClientClass);
                    serviceThreads.Add(spokeHost);
                    Instrument(Common.TransmissionStatusCodes.SVC_START, "Service for " + spoke.HubServiceName + " successfully started.", Common.InstrumentationSources.Spoke, spoke.HubServiceId);

                });
                //host.Open();
                //serviceThreads.Add(host);
            }
        }
开发者ID:jgarverick,项目名称:tetsuo,代码行数:34,代码来源:RouteDispatcherService.cs

示例2: InitializeHubs

 private void InitializeHubs(Uri address)
 {
     EntityManager em = new EntityManager();
     List<Hub> hubs = em.GetHubsByGateway(address);
     foreach(var hub in hubs)
     {
         IServiceHub currentHub = new ServiceHub();
         currentHub.Name = hub.HubName;
         currentHub.OriginAddress = address.OriginalString;
         currentHub.DestinationAddress = address.OriginalString + hub.HubEndpoint;
         ServiceHubs.Add(currentHub);
         Console.WriteLine("Gateway: successfully created endpoint {0}.",
             currentHub.DestinationAddress);
         currentHub.InitializeSpokes(hub.HubId,
             currentHub.OriginAddress, currentHub.DestinationAddress);
     }
 }
开发者ID:jgarverick,项目名称:tetsuo,代码行数:17,代码来源:ServiceResolverGateway.cs


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