protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            AutoMapperConfig.AutoMapper();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
示例#2
0
        private static IContainer RegisterServices(ContainerBuilder builder)
        {
            //Register your Web API controllers.
            builder.RegisterApiControllers(Assembly.GetExecutingAssembly());

            builder.RegisterType <AutoMapperConfig>();
            AutoMapperConfig.AutoMapper();
            AutoMapperConfig.AutoMapperInverse();

            builder.RegisterType <EmployeeDao>()
            .As <IEmployeeDao>()
            .InstancePerRequest();

            //Set the dependency resolver to be Autofac.
            Container = builder.Build();

            return(Container);
        }