本文整理汇总了C#中EntityManager.GetSpokesByHub方法的典型用法代码示例。如果您正苦于以下问题:C# EntityManager.GetSpokesByHub方法的具体用法?C# EntityManager.GetSpokesByHub怎么用?C# EntityManager.GetSpokesByHub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityManager
的用法示例。
在下文中一共展示了EntityManager.GetSpokesByHub方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}