Ejemplo n.º 1
0
        private static IContainer _container;  //声明一个容器
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            ProfileMVC.AutoMapper.Start();

            var builder = new ContainerBuilder();

            builder.RegisterGeneric(typeof(RepositoryBase <>)).As(typeof(IRepositoryBase <>)).PropertiesAutowired();
            builder.RegisterType(typeof(IOC.Server.ShopingServer)).As(typeof(IShopingServer)).PropertiesAutowired();

            //注册controller,使用属性注入
            builder.RegisterControllers(typeof(MvcApplication).Assembly).PropertiesAutowired();

            //注册所有的ApiControllers
            //builder.RegisterApiControllers(Assembly.GetCallingAssembly()).PropertiesAutowired();

            //注册程序集
            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).PropertiesAutowired();

            builder.RegisterModelBinders(typeof(MvcApplication).Assembly);
            builder.RegisterModelBinderProvider();

            // 注册所有的特性
            builder.RegisterFilterProvider();

            // //通过容器配置生成容器.
            _container = builder.Build();

            ////提供给MVC
            DependencyResolver.SetResolver(new AutofacDependencyResolver(_container));

            JobManager.State();
            MiniProfilerEF6.Initialize();
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
        {
            app.UseSerilogUserNameEnricher();

            if (env.IsDevelopment())
            {
                app.UseMiniProfiler();
                MiniProfilerEF6.Initialize();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseStatusCodePagesWithReExecute("/errors/{0}/");
                app.UseExceptionHandler("/errors/error500");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseMvc();

            applicationLifetime.ApplicationStarted.Register(ApplicationStarted);
            applicationLifetime.ApplicationStopped.Register(ApplicationStopped);
        }
Ejemplo n.º 3
0
        protected void Application_Start()
        {
            // If we're using EntityFramework 6, here's where it'd go.
            // This is in the MiniProfiler.EF6 NuGet package.
            MiniProfilerEF6.Initialize();

            // register binders
            ModelBinders.Binders.Add(typeof(SessionInfo), new SessionModelBinder());

            // register auto mapper
            AutoMapperConfig.Register();

            var builder = new ContainerBuilder();

            //register controllers
            builder.RegisterControllers(typeof(MvcApplication).Assembly);

            //register repository
            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).AsImplementedInterfaces();

            //add the Entity Framework context to make sure only one context per request
            builder.RegisterType <SchoolContext>().InstancePerRequest();
            builder.Register(c => c.Resolve <SchoolContext>()).As <DbContext>().InstancePerRequest();

            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
Ejemplo n.º 4
0
        protected void Application_Start()
        {
            _logHelper = LogHelperFactory.GetLogHelper <MvcApplication>();

            if (AppContext.EFProfilerEnable)
            {
                //MiniProfilerEF6初始化,必须放在第一行
                //因为要监控ef,所以要在ef初始化之前
                MiniProfilerEF6.Initialize();
            }
            //ASP.NET 路由操作处理所有请求(甚至包括与现有文件匹配的请求)
            RouteTable.Routes.RouteExistingFiles = true;
            //注册视图引擎
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());
            ViewEngines.Engines.Add(new WebFormViewEngine());
            //注册所有区域
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //ioc配置
            AutofacRegister.RegisterAutofac();

            EFWormUp();
        }
Ejemplo n.º 5
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            MiniProfilerEF6.Initialize();
        }
Ejemplo n.º 6
0
        protected void Application_Start()
        {
            //注册CONTROLLER SI
            DependencyResolver.SetResolver(new UnityDependencyResolver(UnityContaint.Instance.GetContainer()));

            //Unity Containt注入与配置
            RegistUnity();

            AreaRegistration.RegisterAllAreas();

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

            //EF性能框架初始化
            MiniProfilerEF6.Initialize();

            //EF性能预热
            //生成VIEWS
            using (var dbcontext = new ShowTimeDataContent())
            {
                var objectContext     = ((IObjectContextAdapter)dbcontext).ObjectContext;
                var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace);
                mappingCollection.GenerateViews(new List <EdmSchemaError>());
            }
        }
Ejemplo n.º 7
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            //for MiniProfiler
            MiniProfilerEF6.Initialize();
            MiniProfiler.Settings.PopupRenderPosition = RenderPosition.BottomRight;
            GlobalFilters.Filters.Add(new StackExchange.Profiling.Mvc.ProfilingActionFilter());

            //init Interface & Repository Domain
            IoCContainer.InitializeContainer();

            //for report telerik
            ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration);

            //Quartz
            ScheduleHelper.init();

            //using (StreamWriter writer = File.CreateText(Server.MapPath("~/log.txt")))
            //{
            //    Helpers.Common.ConnectionMultiplexer = ConnectionMultiplexer.Connect("localhost,abortConnect=false", writer);
            //}
        }
Ejemplo n.º 8
0
        private static void InitProfilerSettings()
        {
            MiniProfilerOptions options = new MiniProfilerOptions()
            {
                Storage = new MemoryCacheStorage(new TimeSpan(1, 0, 0)),

                PopupRenderPosition  = RenderPosition.Right, // defaults to left
                PopupMaxTracesToShow = 10,                   // defaults to 15

                // ResultsAuthorize (optional - open to all by default):
                // because profiler results can contain sensitive data (e.g. sql queries with parameter values displayed), we
                // can define a function that will authorize clients to see the JSON or full page results.
                // we use it on http://stackoverflow.com to check that the request cookies belong to a valid developer.
                ResultsAuthorize = request => request.IsLocal,

                // the list of all sessions in the store is restricted by default, you must return true to allow it
                ResultsListAuthorize = request => request.IsLocal,

                // Stack trace settings
                StackMaxLength = 256, // default is 120 characters,
            }
            .AddViewProfiling();      // Add MVC view profiling

            options.IgnoredPaths.Add("/hangfire");

            MiniProfiler.Configure(options);
            MiniProfilerEF6.Initialize();
        }
        protected void Application_Start()
        {
            // Tell application to use our custom Ioc (autofac)
            DIConfig.RegisterIoc();

            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            // Configures Fluent Validation.
            FluentValidationModelValidatorProvider.Configure();

            Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("nl-NL");
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("nl-NL");

            System.Globalization.CultureInfo.DefaultThreadCurrentCulture   = new System.Globalization.CultureInfo("nl-NL");
            System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = new System.Globalization.CultureInfo("nl-NL");
            // Depending on the setting we profile.
            if (Properties.Settings.Default.EnableProfiler)
            {
                // Non SQL Server based installs can use other formatters like: new StackExchange.Profiling.SqlFormatters.InlineFormatter()
                MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();
                MiniProfiler.Settings.Storage      = new HttpRuntimeCacheStorage(TimeSpan.FromDays(1));

                // Start the profiler.
                MiniProfilerEF6.Initialize();
            }
        }
Ejemplo n.º 10
0
        protected void Application_Start()
        {
            System.Linq.Dynamic.Core.ExtensibilityPoint.QueryOptimizer = ExpressionOptimizer.visit;
            QueryInterceptor.Core.ExtensibilityPoint.QueryOptimizer    = ExpressionOptimizer.visit;

            AreaRegistration.RegisterAllAreas();

            //GlobalConfiguration.Configuration.EnableCors(new EnableCorsAttribute("*", "*", "*"));

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

            ModelBinders.Binders.Add(typeof(DateTime), new MyDateTimeBinder());

            if (_miniProfilerEnabled)
            {
                MiniProfiler.Settings.PopupRenderPosition = RenderPosition.Right;
                MiniProfiler.Settings.SqlFormatter        = new SqlServerFormatter();
                MiniProfiler.Settings.ShowControls        = false;
                MiniProfilerEF6.Initialize();
            }

            UnityMVCBootstrapper.Initialise(UnityBootstrapper.Container);

            InitAutoMapper(type => UnityBootstrapper.Container.Resolve(type, null));

            FluentValidationModelValidatorProvider.Configure();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// The application start event.
        /// </summary>
        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);

            InitProfilerSettings();

            // this is only done for testing purposes so we don't check in the db to source control
            // parameter table is only used in this project for sample queries
            // yes, it is ugly, and do not do this unless you know for sure that the second Store in the MultiStorageProvider is of this type
            ((SqliteMiniProfilerStorage)((MultiStorageProvider)MiniProfiler.Settings.Storage).Stores[1]).RecreateDatabase("create table RouteHits(RouteName,HitCount,unique(RouteName))");

            var entityFrameworkDataPath = HttpContext.Current.Server.MapPath("~/App_Data/SampleWeb.EFCodeFirst.EFContext.sdf");

            if (File.Exists(entityFrameworkDataPath))
            {
                File.Delete(entityFrameworkDataPath);
            }

            // Setup profiler for Controllers via a Global ActionFilter
            GlobalFilters.Filters.Add(new ProfilingActionFilter());

            // initialize automatic view profiling
            var copy = ViewEngines.Engines.ToList();

            ViewEngines.Engines.Clear();
            foreach (var item in copy)
            {
                ViewEngines.Engines.Add(new ProfilingViewEngine(item));
            }

            MiniProfilerEF6.Initialize();
        }
Ejemplo n.º 12
0
        public override void PreInitialize()
        {
            MiniProfilerEF6.Initialize();
            Database.SetInitializer(new CreateDatabaseIfNotExists <MyAbpDemoDbContext>());

            Configuration.DefaultNameOrConnectionString = "Default";
        }
Ejemplo n.º 13
0
        // The bootstrapper enables you to reconfigure the composition of the framework,
        // by overriding the various methods and properties.
        // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            MiniProfilerEF6.Initialize();

            base.ApplicationStartup(container, pipelines);
            pipelines.BeforeRequest += PreRequest;
            pipelines.AfterRequest  += PostRequest;

            //Make sure that the IoC container does not return singletons for EF.
            container.Register <IAppDbContext, AppDbContext>().AsPerRequestSingleton();

            //Setup Forms Auth
            var formsAuthConfig = new FormsAuthenticationConfiguration
            {
                RedirectUrl = "~/auth/login",
                UserMapper  = container.Resolve <IUserMapper>(),
                RequiresSSL = true,
                CryptographyConfiguration = CreateCrypto()
            };

            FormsAuthentication.Enable(pipelines, formsAuthConfig);

            //Set up custom view resolution, looks in Modules/{ModuleName}/{ViewName}.cshtml
            Conventions.ViewLocationConventions.Add((viewName, model, context) => $"Modules/{context.ModuleName}/{viewName}");
        }
Ejemplo n.º 14
0
        protected void Application_Start()
        {
            EngineContext.Initialize(false);

            //启用该功能,则需要手动到数据库里创建一个表:
            //create table edmmetadata (id int,modelhash varchar(50));
            MiniProfilerEF6.Initialize();

            //bool databaseInstalled = DataSettingsHelper.DatabaseIsInstalled();

            //set dependency resolver
            var dependencyResolver = new DiskDependencyResolver();

            DependencyResolver.SetResolver(dependencyResolver);

            //Add some functionality on top of the default ModelMetadataProvider
            ModelMetadataProviders.Current = new DiskMetadataProvider();

            //init data provider
            //var dataProviderInstance = EngineContext.Current.Resolve<BaseDataProviderManager>().LoadDataProvider();
            //dataProviderInstance.InitDatabase();

            //Registering some regular mvc stuff
            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);

            //fluent validation
            DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;
            ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(new DiskValidatorFactory()));

            BundleConfig.RegisterBundles(BundleTable.Bundles);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        }
Ejemplo n.º 15
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            MiniProfilerEF6.Initialize();
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //MapConfig.RegisterMaps();
            //Bootstrapper.MapConfig.RegisterMaps();
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
            //ModelBinders.Binders.Add(typeof(decimal?), new DecimalModelBinder());

            MvcHandler.DisableMvcResponseHeader = true;

            // miniprofiler setup
            //MiniProfiler.Settings.Results_Authorize = IsUserAllowedToSeeMiniProfilerResults;
            //MiniProfiler.Settings.Results_List_Authorize = IsUserAllowedToSeeMiniProfilerResults;
            //MiniProfiler.Settings.Storage = new HttpRuntimeCacheStorage(TimeSpan.FromDays(1));
            //MiniProfiler.Settings.PopupRenderPosition = RenderPosition.BottomRight;

            //GlobalFilters.Filters.Add(new ProfilingActionFilter());
            //MiniProfiler.Settings.MaxJsonResponseSize = 2147483647;
            //MiniProfiler.Settings.ExcludeAssembly("Tronix.Background");
            //var ignoredPaths = MiniProfiler.Settings.IgnoredPaths.ToList();
            //ignoredPaths.Add("hangfire/");
            //MiniProfiler.Settings.IgnoredPaths = ignoredPaths.ToArray();
            //var copy = ViewEngines.Engines.ToList();
            //ViewEngines.Engines.Clear();
            //foreach (var item in copy)
            //{
            //    ViewEngines.Engines.Add(new ProfilingViewEngine(item));
            //}

            //ControllerBuilder.Current.SetControllerFactory(typeof(SessionControllerFactory));

            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            //ScriptManager.ScriptResourceMapping.AddDefinition("jquery", null, new ScriptResourceDefinition { Path = "~/Scripts/fakejquery.js" });

            //ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
            //ModelMetadataProviders.Current = new Infrastructure.Providers.TronixModelMetadataProvider();
            //var providers = new EntityFramework.Utilities.IQueryProvider[EntityFramework.Utilities.Configuration.Providers.Count];
            //EntityFramework.Utilities.Configuration.Providers.CopyTo(providers, 0);
            //EntityFramework.Utilities.Configuration.Providers.Clear();

            //for (var i = 0; i < providers.Length; i++)
            //{
            //    EntityFramework.Utilities.Configuration.Providers.Add(new ProfiledQueryProvider(providers[i]));
            //}
            //if ((ConfigurationManager.AppSettings["Hangfire.Run"] ?? "").Equals("true", StringComparison.OrdinalIgnoreCase))
            //{
            //    KeepAlive.Instance.Start();
            //}
        }
Ejemplo n.º 16
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            //GlobalConfiguration.Configuration.EnableCors(new EnableCorsAttribute("*", "*", "*"));

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

            ModelBinders.Binders.Add(typeof(DateTime), new MyDateTimeBinder());

            InitAutoMapper();

            if (_miniProfilerEnabled)
            {
                MiniProfiler.Settings.PopupRenderPosition = RenderPosition.Right;
                MiniProfiler.Settings.SqlFormatter        = new SqlServerFormatter();
                MiniProfiler.Settings.ShowControls        = false;
                MiniProfilerEF6.Initialize();
            }

            UnityMVCBootstrapper.Initialise(UnityBootstrapper.Container);

            FluentValidationModelValidatorProvider.Configure();
        }
Ejemplo n.º 17
0
        public void InitializeEf6Profiler()
        {
            _logger = new TestLogger();
            var profiler = new LongRunningQueryProfiler(_logger, threshold: 200.Milliseconds());

            MiniProfiler.DefaultOptions.ProfilerProvider = new ProfilerGetter(profiler);
            MiniProfilerEF6.Initialize();
        }
Ejemplo n.º 18
0
 protected override void Application_Start(object sender, EventArgs e)
 {
     MiniProfilerEF6.Initialize();
     AbpBootstrapper.IocManager.IocContainer.AddFacility <LoggingFacility>(
         f => f.UseAbpLog4Net().WithConfig(Server.MapPath("log4net.config"))
         );
     base.Application_Start(sender, e);
 }
Ejemplo n.º 19
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     MiniProfilerEF6.Initialize();
 }
Ejemplo n.º 20
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            MiniProfilerEF6.Initialize();
            Database.SetInitializer(new MigrateDatabaseToLatestVersion <HighlighterDbContext, Configuration>());
        }
Ejemplo n.º 21
0
        public override void PostInitialize()
        {
            BinderManager.Bind();

            if (AppConfig.MiniProfilerEnable)
            {
                MiniProfilerEF6.Initialize();
            }
        }
Ejemplo n.º 22
0
        protected void Application_Start()
        {
            MiniProfilerEF6.Initialize();
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
Ejemplo n.º 23
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // If you want to profile views, wrap the view engine like this:
            MiniProfilerEF6.Initialize();
        }
Ejemplo n.º 24
0
        void Application_Start(object sender, EventArgs e)
        {
            //EO.Pdf.Runtime.AddLicense("");

            ShopperConfiguration.Default = ShopperConfigurationReader.FromWebConfig();

#if DEBUG
            MiniProfilerEF6.Initialize();
#endif
        }
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     //GlobalFilters.Filters.Add(new ApiExpLogFilter());
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     MiniProfilerEF6.Initialize();
 }
Ejemplo n.º 26
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            MiniProfiler.Configure(new MiniProfilerOptions().AddViewProfiling()); //MiniProfiler默认设置
            MiniProfilerEF6.Initialize();                                         //配置EF分析
        }
Ejemplo n.º 27
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            MiniProfilerEF6.Initialize();

            Database.SetInitializer(new MigrateDatabaseToLatestVersion <ApplicationDbContext, Configuration>());
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Application_s the start.
 /// </summary>
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     MiniProfilerEF6.Initialize();
     MiniProfiler.Settings.SqlFormatter = new SqlServerFormatter();
 }
Ejemplo n.º 29
0
        public static void RegisterMiniProfiler()
        {
            MiniProfiler.Configure(new MiniProfilerOptions()
            {
                PopupShowTrivial          = true,
                PopupShowTimeWithChildren = true
            }).AddViewPofiling();

            MiniProfilerEF6.Initialize();
        }
Ejemplo n.º 30
0
        protected void Application_Start()
        {
            MiniProfilerEF6.Initialize();

            //most of API providers require TLS 1.2 nowadays
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            //disable "X-AspNetMvc-Version" header name
            MvcHandler.DisableMvcResponseHeader = true;

            //initialize engine context
            EngineContext.Initialize(false);

            //Add some functionality on top of the default ModelMetadataProvider
            ModelMetadataProviders.Current = new BaseEamMetadataProvider();

            //Registering some regular mvc stuff
            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);

            //fluent validation
            var fluentValidationModelValidatorProvider = new FluentValidationModelValidatorProvider(new BaseEamValidatorFactory());

            fluentValidationModelValidatorProvider.AddImplicitRequiredValidator             = false;
            DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;
            ModelValidatorProviders.Providers.Add(fluentValidationModelValidatorProvider);

            //notification
            GlobalFilters.Filters.Add(new NotifyAttribute());
            GlobalFilters.Filters.Add(new ProfilingActionFilter());

            // initialize automatic view profiling
            var copy = ViewEngines.Engines.ToList();

            ViewEngines.Engines.Clear();
            foreach (var item in copy)
            {
                ViewEngines.Engines.Add(new ProfilingViewEngine(item));
            }

            //MiniProfilerEF6.Initialize();

            //log application start
            try
            {
                //log
                var logger = EngineContext.Current.Resolve <ILogger>();
                logger.Information("Application started", null, null);
            }
            catch (Exception)
            {
                //don't throw new exception if occurs
            }
        }