本文整理汇总了C#中Autofac.ContainerBuilder.RegisterModules方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerBuilder.RegisterModules方法的具体用法?C# ContainerBuilder.RegisterModules怎么用?C# ContainerBuilder.RegisterModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autofac.ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder.RegisterModules方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterModules
public void RegisterModules()
{
var builder = new ContainerBuilder();
builder.RegisterModules(Assembly.GetExecutingAssembly());
var container = builder.Build();
Assert.IsNotNull(container.Resolve<IContainerModule>());
}
示例2: RegisterContainer
private void RegisterContainer()
{
var builder = new ContainerBuilder();
builder.RegisterControllers(Assembly.GetExecutingAssembly());
builder.RegisterModules(Assembly.GetExecutingAssembly());
_container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(_container));
}
示例3: InitializeApplication
private void InitializeApplication(ContainerBuilder builder, Module[] modules)
{
builder.RegisterInstance(new DefaultMessageBus()).As<IBus>().SingleInstance();
builder.RegisterModules(modules);
builder.RegisterModule(new ViewModelModule());
ContainerHolder.Initialize(builder.Build());
MainPage = new NavigationPage(new LoginPage())
{
BarBackgroundColor = Color.FromHex("#3C8513"),
BarTextColor = Color.FromHex("#FCD23C")
};
Navigation = MainPage.Navigation;
}
示例4: Init
public static IContainer Init()
{
var builder = new ContainerBuilder();
var assembly = Assembly.GetExecutingAssembly();
builder.RegisterApiControllers(assembly);
builder.RegisterBootstrappers(assembly);
builder.RegisterModules();
builder
.RegisterType<Foo>()
.AsSelf();
var container = builder.Build();
container.ConfigureDependencyResolver();
container.InitBootstrappers();
return container;
}