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