public void AutoMapper_Should_Map_All_Profiles() { //Arrange //Act AutoMapperInitializer.InitAutoMapper(); //Assert Mapper.AssertConfigurationIsValid(); }
protected void Application_Start() { var builder = new ContainerBuilder(); // Register your MVC controllers. builder.RegisterControllers(typeof(MvcApplication).Assembly); // OPTIONAL: Register model binders that require DI. builder.RegisterModelBinders(Assembly.GetExecutingAssembly()); builder.RegisterModelBinderProvider(); // OPTIONAL: Register web abstractions like HttpContextBase. builder.RegisterModule <AutofacWebTypesModule>(); // OPTIONAL: Enable property injection in view pages. builder.RegisterSource(new ViewRegistrationSource()); // OPTIONAL: Enable property injection into action filters. builder.RegisterFilterProvider(); // Register dependencies in filter attributes builder.RegisterFilterProvider(); // Register dependencies in custom views builder.RegisterSource(new ViewRegistrationSource()); // Register our Data dependencies builder.RegisterModule(new DataProviderModule()); builder.RegisterModule(new LogicModule()); // builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource( //t => !(t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Meta<>)))); var container = builder.Build(); // Set MVC DI resolver to use our Autofac container DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // AutoMapper Initialization AutoMapperInitializer.InitAutoMapper(); MySqlWebSecurity.InitializeDatabaseConnection("WarehouseContext"); }
protected void Application_Start() { GlobalConfiguration.Configure(WebApiConfig.Register); AutoMapperInitializer.InitAutoMapper(); }