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


C# IServiceLocator.ResolveAll方法代码示例

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


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

示例1: ApplyServiceBehaviors

 /// <summary>
 /// Applies the service behaviors.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 private void ApplyServiceBehaviors(IServiceLocator serviceLocator)
 {
     var registeredServiceBehaviors = serviceLocator.ResolveAll<IServiceBehavior>();
     foreach (var serviceBehavior in registeredServiceBehaviors)
     {
         Description.Behaviors.Add(serviceBehavior);
     }
 }
开发者ID:hallco978,项目名称:Griffin.Container,代码行数:12,代码来源:ServiceLocatorServiceHost.cs

示例2: VerifyContainer

 protected static void VerifyContainer(IServiceLocator serviceLocator, int expected)
 {
     Assert.That(serviceLocator.Resolve(typeof(EventStore)), Is.Not.Null);
     var array = serviceLocator.ResolveAll(typeof(IEventHandler<AggregateChanged>));
     Assert.That(array, Is.Not.Null);
     Assert.That(array.Length, Is.EqualTo(expected));
     if (expected == 1)
         Assert.That(serviceLocator.Resolve(typeof(IEventHandler<AggregateChanged>)), Is.Not.Null);
 }
开发者ID:bbqchickenrobot,项目名称:EventStoreLite,代码行数:9,代码来源:InstallerTest.cs

示例3: ApplyContractBehaviors

 /// <summary>
 /// Applies the contract behaviors.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 private void ApplyContractBehaviors(IServiceLocator serviceLocator)
 {
     var registeredContractBehaviors = serviceLocator.ResolveAll<IContractBehavior>();
     foreach (var contractBehavior in registeredContractBehaviors)
     {
         foreach (var contractDescription in ImplementedContracts.Values)
         {
             contractDescription.Behaviors.Add(contractBehavior);
         }
     }
 }
开发者ID:hallco978,项目名称:Griffin.Container,代码行数:15,代码来源:ServiceLocatorServiceHost.cs

示例4: RegisterMsmqTransport

        private void RegisterMsmqTransport(AbstractRhinoServiceBusConfiguration c, IBusContainerBuilder b, IServiceLocator l, Type queueStrategyType)
        {
            if (queueStrategyType == typeof(FlatQueueStrategy))
                b.RegisterSingleton<IQueueStrategy>(() => (IQueueStrategy)new FlatQueueStrategy(
                    l.Resolve<IEndpointRouter>(),
                    c.Endpoint));
            else
                b.RegisterSingleton<IQueueStrategy>(() => (IQueueStrategy)new SubQueueStrategy());

            b.RegisterSingleton<IMessageBuilder<Message>>(() => (IMessageBuilder<Message>)new MsmqMessageBuilder(
                l.Resolve<IMessageSerializer>(),
                l.Resolve<IServiceLocator>()));

            b.RegisterSingleton<IMsmqTransportAction>(Guid.NewGuid().ToString(), () => (IMsmqTransportAction)new ErrorAction(
                c.NumberOfRetries,
                l.Resolve<IQueueStrategy>()));

            b.RegisterSingleton<ISubscriptionStorage>(() => (ISubscriptionStorage)new MsmqSubscriptionStorage(
                l.Resolve<IReflection>(),
                l.Resolve<IMessageSerializer>(),
                c.Endpoint,
                l.Resolve<IEndpointRouter>(),
                l.Resolve<IQueueStrategy>()));

            b.RegisterSingleton<ITransport>(() => (ITransport)new MsmqTransport(
                l.Resolve<IMessageSerializer>(),
                l.Resolve<IQueueStrategy>(),
                c.Endpoint,
                c.ThreadCount,
                l.ResolveAll<IMsmqTransportAction>().ToArray(),
                l.Resolve<IEndpointRouter>(),
                c.IsolationLevel,
                c.Transactional,
                c.ConsumeInTransaction,
                l.Resolve<IMessageBuilder<Message>>()));

            b.RegisterAll<IMsmqTransportAction>(typeof(ErrorAction));
        }
开发者ID:BiYiTuan,项目名称:rhino-esb,代码行数:38,代码来源:MsmqTransportConfigurationAware.cs

示例5: PostLoadProcessService

 /// <summary>
 ///   Initializes a new instance of the <see cref="PostLoadProcessService" /> class.
 /// </summary>
 /// <param name="processors"> The processors. </param>
 public PostLoadProcessService(IServiceLocator serviceLocator)
 {
     _serviceLocator = serviceLocator;
     _processors = _serviceLocator.ResolveAll<IPostLoadProcessor>();
 }
开发者ID:jgauffin,项目名称:Griffin.Wiki,代码行数:9,代码来源:PostLoadProcessService.cs


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