本文整理汇总了C#中Autofac.ContainerBuilder.RegisterFeature方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerBuilder.RegisterFeature方法的具体用法?C# ContainerBuilder.RegisterFeature怎么用?C# ContainerBuilder.RegisterFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autofac.ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder.RegisterFeature方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
public void Register(ContainerBuilder builder)
{
builder.RegisterFeature<MappingFeature>();
builder.RegisterFeature<PatternsFeature>();
builder.RegisterInstance(new WestpacCsvImportDetector()).As<IImportDetector>();
builder.RegisterInstance(new AsbOrbitFastTrackCsvImportDetector()).As<IImportDetector>();
builder.RegisterInstance(new AsbVisaCsvImportDetector()).As<IImportDetector>();
builder.RegisterInstance(new WestpacVisaCsvImportDetector()).As<IImportDetector>();
builder.RegisterType<ImportDetector>();
builder.RegisterType<TransactionImportContext>();
builder.RegisterType<GeneralLedger>()
.As<IAccountLookup>()
.AsSelf();
}
示例2: GetCompositionRoot
public static ContainerBuilder GetCompositionRoot()
{
var builder = new ContainerBuilder();
builder.RegisterFeature<ApplicationFeature>();
builder.RegisterFeature<SqlStoreFeature>();
builder.RegisterFeature<TestLogging>();
builder.RegisterType<TestDatabase>()
.OnActivated(args => args.Instance.ApplyMigrations())
.InstancePerLifetimeScope();
builder.Register(resolver => resolver.Resolve<TestDatabase>().Database);
builder.RegisterType<TestData.AccountLookup>()
.As<IAccountLookup>();
return builder;
}
示例3: Register
public void Register(ContainerBuilder builder)
{
builder.RegisterFeature<LoggingFeature>();
builder.Register(resolver => LogSink.Configure(ConfigureTestLogging));
}
示例4: RegisterIoc
private IContainer RegisterIoc(ContainerBuilder builder)
{
builder.RegisterType<MappingProvider>();
builder.RegisterType<ViewModels.ViewModelTypeMapProvider>().As<ITypeMapProvider>();
builder.Register(c => c.Resolve<MappingProvider>().Build());
var path = MapPath("~/App_Data");
builder.Register(c => new DirectoryExplorer(path));
builder.RegisterFeature<ApplicationFeature>();
builder.RegisterFeature<SqlStoreFeature>();
RegisterDataProvider(builder);
builder.RegisterControllers(typeof (MvcApplication).Assembly);
IContainer container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
return container;
}