Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        protected override void OnApplicationStarted()
        {
            base.OnApplicationStarted();

            GlobalConfiguration.Configure(WebApiConfig.Register);

            MappersConfigurator.ConfigureMapping();
        }
Exemplo n.º 2
0
        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        public void Configuration(IAppBuilder appBuilder)
        {
            MappersConfigurator.ConfigureMapping();

            // Configure Web API for self-host.
            var configuration = new HttpConfiguration();

            configuration.MapHttpAttributeRoutes();

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

            appBuilder
            .Use <SessionManagerMiddleware>()
            .UseNinjectMiddleware(CreateKernel)
            .UseNinjectWebApi(configuration);
        }