예제 #1
0
        protected void Application_Start()
        {
            DependencyConfig.RegisterSimpleInjector();

            MvcHandler.DisableMvcResponseHeader = true;
            ModelBinders.Binders.DefaultBinder  = new SmartBinder();
            ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
            ModelBinders.Binders.Add(typeof(decimal?), new DecimalModelBinder());
            ModelBinders.Binders.Add(typeof(int?), new NullableIntModelBinder());
            ModelMetadataProviders.Current = new ModelViewMetadataProvider();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            RouteTable.Routes.RouteExistingFiles = true;
            HttpRuntime.Cache.Remove("BuildDate");

            ValueProviderFactories.Factories.Remove(ValueProviderFactories.Factories.OfType <JsonValueProviderFactory>().FirstOrDefault());
            ValueProviderFactories.Factories.Add(new JsonNetValueProviderFactory());
            if (Util.IsDebug())
            {
                DbUtil.Migrate();
            }
        }