protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     AutofacConfig.Configure();
 }
Beispiel #2
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public IServiceProvider ConfigureServices(IServiceCollection services)
 {
     services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
     SwaggerConfig.Register(services);
     return(AutofacConfig.Configure(builder =>
     {
         var types = Assembly.Load("Sqr.DC.Business").GetTypes().Where(c => c.IsSubclassOf(typeof(Autofac.Module)));
         builder.RegisterAssemblyModules(Assembly.GetExecutingAssembly());
         builder.RegisterAssemblyModules(Assembly.Load("Sqr.DC.Business"));
         builder.RegisterAssemblyModules(Assembly.Load("Sqr.DC.EF"));
         builder.Populate(services);
         return null;
     }));
 }
Beispiel #3
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            AutofacConfig.Configure(config);
        }