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(); }
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; }
public void Register(ContainerBuilder builder) { builder.RegisterFeature<LoggingFeature>(); builder.Register(resolver => LogSink.Configure(ConfigureTestLogging)); }
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; }