// ConfigureContainer is where you can register things directly // with Autofac. This runs after ConfigureServices so the things // here will override registrations made in ConfigureServices. // Don't build the container; that gets done for you. If you // need a reference to the container, you need to use the // "Without ConfigureContainer" mechanism shown later. public void ConfigureContainer(ContainerBuilder builder) { builder.RegisterModule(new EventBusModule()); this.OnConfigureContainer(builder); var configuration = new RabbitMQBusConfiguration(); configuration = configuration.WithUser("rabbitmq").WithPassWord("rabbitmq") .WithHost("RabbitMQ") as RabbitMQBusConfiguration; builder.RegisterInstance(configuration).As <IBusConfiguration>().SingleInstance(); }
// ConfigureContainer is where you can register things directly // with Autofac. This runs after ConfigureServices so the things // here will override registrations made in ConfigureServices. // Don't build the container; that gets done for you. If you // need a reference to the container, you need to use the // "Without ConfigureContainer" mechanism shown later. public void ConfigureContainer(ContainerBuilder builder) { builder.RegisterModule(new EventBusModule()); builder.RegisterType <DataContext>().AsSelf().InstancePerLifetimeScope(); builder.RegisterType <UserService>().As <IUserService>().InstancePerRequest().InstancePerDependency(); var configuration = new RabbitMQBusConfiguration(); configuration = configuration.WithUser("rabbitmq").WithPassWord("rabbitmq") .WithHost("RabbitMQ") as RabbitMQBusConfiguration; builder.RegisterInstance(configuration).As <IBusConfiguration>().SingleInstance(); }