本文整理汇总了C#中Autofac.ContainerBuilder.RegisterConsumers方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerBuilder.RegisterConsumers方法的具体用法?C# ContainerBuilder.RegisterConsumers怎么用?C# ContainerBuilder.RegisterConsumers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autofac.ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder.RegisterConsumers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
protected override void Load(ContainerBuilder builder)
{
// Registers all consumers with our container
builder.RegisterConsumers(_assembliesToScan);
// Creates our bus from the factory and registers it as a singleton against two interfaces
builder.Register(c => Bus.Factory.CreateUsingRabbitMq(sbc =>
{
var componentContext = c.Resolve<IComponentContext>();
var host = sbc.Host(new Uri(ConfigurationManager.AppSettings["RabbitMQHost"]), h =>
{
// Configure your host
h.Username(ConfigurationManager.AppSettings["RabbitMQUsername"]);
h.Password(ConfigurationManager.AppSettings["RabbitMQPassword"]);
});
sbc.ReceiveEndpoint(host, ConfigurationManager.AppSettings["MyMessageQueueName"], e =>
{
// Configure your consumer(s)
e.PrefetchCount = 4;
e.LoadFrom(componentContext.Resolve<ILifetimeScope>());
});
}))
.SingleInstance()
.As<IBusControl>()
.As<IBus>();
}
示例2: Registration_extension_method_for_consumers
public void Registration_extension_method_for_consumers()
{
var builder = new ContainerBuilder();
builder.RegisterConsumers(System.Reflection.Assembly.GetExecutingAssembly());
var container = builder.Build();
Assert.That(container.IsRegistered<TestConsumer>(), Is.True);
}
示例3: Load
protected override void Load(ContainerBuilder builder)
{
builder.RegisterConsumers(_assembliesToScan);
// Creates our bus from the factory and registers it as a singleton against two interfaces
builder.Register(c => Bus.Factory.CreateUsingRabbitMq(sbc => sbc.Host(new Uri(ConfigurationManager.AppSettings["RabbitMQHost"]), h =>
{
h.Username(ConfigurationManager.AppSettings["RabbitMQUsername"]);
h.Password(ConfigurationManager.AppSettings["RabbitMQPassword"]);
})))
.As<IBusControl>()
.As<IBus>()
.SingleInstance();
}
示例4: Throw_them_under_the_bus
public async Task Throw_them_under_the_bus()
{
var builder = new ContainerBuilder();
builder.RegisterConsumers(Assembly.GetExecutingAssembly());
builder.RegisterType<InMemorySagaRepository<SimpleSaga>>()
.As<ISagaRepository<SimpleSaga>>()
.SingleInstance();
var container = builder.Build();
var busControl = Bus.Factory.CreateUsingInMemory(x =>
{
x.ReceiveEndpoint("input_queue", e => e.LoadFrom(container));
});
var busHandle = await busControl.StartAsync();
await busHandle.Ready;
await busHandle.StopAsync();
}
示例5: Load
protected override void Load(ContainerBuilder builder)
{
builder.RegisterConsumers(typeof(SendDocketLinkNotificationConsumer).Assembly);
}