protected void Application_Start() { // we use our own mobile devices support (".Mobile" is reserved). that's why we disable it. var mobileDisplayMode = DisplayModeProvider.Instance.Modes.FirstOrDefault(x => x.DisplayModeId == DisplayModeProvider.MobileDisplayModeId); if (mobileDisplayMode != null) { DisplayModeProvider.Instance.Modes.Remove(mobileDisplayMode); } bool installed = DataSettings.DatabaseIsInstalled(); if (installed) { // remove all view engines ViewEngines.Engines.Clear(); } // initialize engine context EngineContext.Initialize(false); // model binders ModelBinders.Binders.DefaultBinder = new SmartModelBinder(); // Add some functionality on top of the default ModelMetadataProvider ModelMetadataProviders.Current = new SmartMetadataProvider(); // Register MVC areas AreaRegistration.RegisterAllAreas(); // fluent validation DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(new SmartValidatorFactory())); // Routes RegisterRoutes(RouteTable.Routes, installed); // localize MVC resources ClientDataTypeModelValidatorProvider.ResourceClassKey = "MvcLocalization"; DefaultModelBinder.ResourceClassKey = "MvcLocalization"; ErrorMessageProvider.SetResourceClassKey("MvcLocalization"); if (installed) { // register our themeable razor view engine we use ViewEngines.Engines.Add(new ThemeableRazorViewEngine()); // Global filters RegisterGlobalFilters(GlobalFilters.Filters); // Bundles RegisterBundles(BundleTable.Bundles); // register virtual path provider for theming (file inheritance & variables handling) HostingEnvironment.RegisterVirtualPathProvider(new ThemingVirtualPathProvider(HostingEnvironment.VirtualPathProvider)); BundleTable.VirtualPathProvider = HostingEnvironment.VirtualPathProvider; // register plugin debug view virtual path provider if (HttpContext.Current.IsDebuggingEnabled) { HostingEnvironment.RegisterVirtualPathProvider(new PluginDebugViewVirtualPathProvider()); } // "throw-away" filter for task scheduler initialization (the filter removes itself when processed) GlobalFilters.Filters.Add(new InitializeSchedulerFilter()); } else { // app not installed // Install filter GlobalFilters.Filters.Add(new HandleInstallFilter()); } }
protected void Application_Start() { // we use our own mobile devices support (".Mobile" is reserved). that's why we disable it. var mobileDisplayMode = DisplayModeProvider.Instance.Modes.FirstOrDefault(x => x.DisplayModeId == DisplayModeProvider.MobileDisplayModeId); if (mobileDisplayMode != null) { DisplayModeProvider.Instance.Modes.Remove(mobileDisplayMode); } bool installed = DataSettings.DatabaseIsInstalled(); if (installed) { // Remove all view engines ViewEngines.Engines.Clear(); } // Initialize engine context var engine = EngineContext.Initialize(false); // Model binders ModelBinders.Binders.DefaultBinder = new SmartModelBinder(); // Add some functionality on top of the default ModelMetadataProvider ModelMetadataProviders.Current = new SmartMetadataProvider(); // Register MVC areas AreaRegistration.RegisterAllAreas(); // Fluent validation FluentValidationModelValidatorProvider.Configure(x => { x.ValidatorFactory = new SmartValidatorFactory(); }); // Routes RegisterRoutes(RouteTable.Routes, engine, installed); // localize MVC resources ClientDataTypeModelValidatorProvider.ResourceClassKey = "MvcLocalization"; DefaultModelBinder.ResourceClassKey = "MvcLocalization"; ErrorMessageProvider.SetResourceClassKey("MvcLocalization"); // Register JsEngine RegisterJsEngines(); if (installed) { // register our themeable razor view engine we use ViewEngines.Engines.Add(new ThemeableRazorViewEngine()); // Global filters RegisterGlobalFilters(GlobalFilters.Filters, engine); // Bundles RegisterBundles(BundleTable.Bundles, engine); // VPPs RegisterVirtualPathProviders(); // "throw-away" filter for task scheduler initialization (the filter removes itself when processed) GlobalFilters.Filters.Add(new InitializeSchedulerFilter(), int.MinValue); // register AutoMapper class maps RegisterClassMaps(engine); } else { // app not installed // Install filter GlobalFilters.Filters.Add(new HandleInstallFilter()); } }
public void SetUp() { systemUnderTest = new ErrorMessageProvider(); }
public string Format <TErrorCode>(IEnumerable <ErrorContainer <TErrorCode> > errors, ErrorMessageProvider <TErrorCode> provider) { return(string.Join( "<br>", errors.Select(e => { var errorMessage = provider.ErrorMessage(e.ErrorCode); errorMessage = string.Format(errorMessage, e.Item); return errorMessage; }) )); }
protected void Application_Start() { // SSL & TLS ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, errors) => true; // we use our own mobile devices support (".Mobile" is reserved). that's why we disable it. var mobileDisplayMode = DisplayModeProvider.Instance.Modes.FirstOrDefault(x => x.DisplayModeId == DisplayModeProvider.MobileDisplayModeId); if (mobileDisplayMode != null) { DisplayModeProvider.Instance.Modes.Remove(mobileDisplayMode); } bool installed = DataSettings.DatabaseIsInstalled(); if (installed) { // Remove all view engines ViewEngines.Engines.Clear(); } // Initialize engine context var engine = EngineContext.Initialize(false); // Model binders ModelBinders.Binders.DefaultBinder = new SmartModelBinder(); // Add some functionality on top of the default ModelMetadataProvider ModelMetadataProviders.Current = new SmartMetadataProvider(); // Register MVC areas AreaRegistration.RegisterAllAreas(); // Fluent validation InitializeFluentValidator(); // Routes RegisterRoutes(RouteTable.Routes, engine, installed); // Localize MVC resources ClientDataTypeModelValidatorProvider.ResourceClassKey = "MvcLocalization"; DefaultModelBinder.ResourceClassKey = "MvcLocalization"; ErrorMessageProvider.SetResourceClassKey("MvcLocalization"); // Register JsEngine RegisterJsEngines(); // VPPs RegisterVirtualPathProviders(); // This settings will automatically be used by JsonConvert.SerializeObject/DeserializeObject JsonConvert.DefaultSettings = () => new JsonSerializerSettings { ContractResolver = SmartContractResolver.Instance }; if (installed) { // register our themeable razor view engine we use ViewEngines.Engines.Add(new ThemeableRazorViewEngine()); // Global filters RegisterGlobalFilters(GlobalFilters.Filters, engine); // Bundles RegisterBundles(BundleTable.Bundles, engine); // "throw-away" filter for post startup initialization (the filter removes itself when processed) GlobalFilters.Filters.Add(new PostApplicationStartFilter(), int.MinValue); } else { // app not installed // Install filter GlobalFilters.Filters.Add(new HandleInstallFilter()); } }