Exemplo n.º 1
0
        protected void Application_Start()
        {
            //ModelBinders.Binders.DefaultBinder = new PerpetuumSoft.Knockout.KnockoutModelBinder(); // Todo : this code has beeb added as part of MVC upgrade. It is commented to get create qote sheet workiing.

            AreaRegistration.RegisterAllAreas();

            UnityConfig.RegisterComponents();

            //WebApiConfig.Register(GlobalConfiguration.Configuration);
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            IoCConfig.RegisterIoC(GlobalConfiguration.Configuration);

            ModelMetadataProviders.Current = new MetadataProvider();

            Logger.SetLogWriter(new LogWriterFactory().Create());

            // TODO: comment back in if you want to regenerate the DB...
            //Database.SetInitializer(new MigrateDatabaseToLatestVersion<ConsoleRepository, Configuration>());
            //new ConsoleRepository().Database.Initialize(true);

            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling  = DateTimeZoneHandling.Utc;
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateFormatHandling    = DateFormatHandling.IsoDateFormat;
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateParseHandling     = DateParseHandling.DateTime;
            GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
            GlobalConfiguration.Configuration.Services.RemoveAll(typeof(ApiModelValidatorProvider), mvp => mvp is InvalidModelValidatorProvider);

#if !Debug
            //DatabaseInit.SyncSemiStaticData();
#endif

            //Application["UnderwriterSipAddresses"] = DatabaseInit.GetUnderwriterSipAddresses();
            //Application["UnderwriterEmailAddresses"] = DatabaseInit.GetUnderwriterEmailAddresses();
            new LogHandler().WriteLog("Application_Start", LogSeverity.Information, LogCategory.UI);
        }