예제 #1
0
        public void Configuration(IAppBuilder app)
        {
            var assemblies = BuildManager.GetReferencedAssemblies().Cast <Assembly>().ToArray();

            WebApp = new WebApp();

            var wcc = new WebContainerConfiguration(WebApp.Context);

            wcc.RegisterAllTypes();

            WebApp.BootstrapMvc(assemblies);

            app.UseDataAccess(WebApp.Context);

            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            HttpConfiguration config = new HttpConfiguration
            {
                DependencyResolver = new SimpleInjectorWebApiDependencyResolver(WebApp.GetContainer())
            };

            WebApiConfig.Register(config);

            app.UseWebApi(config);
        }
예제 #2
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            WebApp = new WebApp();

            var wcc = new WebContainerConfiguration(WebApp.Context);

            wcc.RegisterAllTypes();

            // setup web dependency injection
            Assembly[] assemblies = BuildManager.GetReferencedAssemblies().Cast <Assembly>().ToArray();
            WebApp.BootstrapMvc(assemblies);

            config.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(WebApp.GetContainer());

            WebApi.WebApiConfig.Register(config);
        }
예제 #3
0
        public void Init(HttpApplication app)
        {
            Assembly[] assemblies = BuildManager.GetReferencedAssemblies().Cast <Assembly>().ToArray();

            var webapp = new WebApp();

            webapp.Context.EnablePropertyInjection();

            var wcc = webapp.GetConfiguration();

            wcc.RegisterAllTypes();

            RegisterTypes(webapp.Context);

            webapp.BootstrapMvc(assemblies);

            _provider = webapp.Context.GetInstance <IProvider>();

            app.BeginRequest += App_BeginRequest;
            app.EndRequest   += App_EndRequest;
        }