当前位置: 首页>>代码示例>>C#>>正文


C# ContainerBuilder.RegisterFeature方法代码示例

本文整理汇总了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();
        }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:18,代码来源:ApplicationFeature.cs

示例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;
        }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:19,代码来源:IoC.cs

示例3: Register

 public void Register(ContainerBuilder builder)
 {
     builder.RegisterFeature<LoggingFeature>();
     builder.Register(resolver => LogSink.Configure(ConfigureTestLogging));
 }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:5,代码来源:IoC.cs

示例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;
        }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:20,代码来源:Global.asax.cs


注:本文中的Autofac.ContainerBuilder.RegisterFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。