示例#1
0
        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration();

            //  Enable attribute based routing
            config.MapHttpAttributeRoutes();

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

            ConfigureWebApi(config);

            // Package: Unity.Container
            // Unity DI
            UnityInitializer.Initialize(config);

            app.UseWebApi(config);

            // Create the database for test (REMOVE when publish to PROD)
            InitializeDatabaseAsync(config).GetAwaiter().GetResult();
        }