예제 #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            new RouteConfigurator(RouteTable.Routes).Configure();

            InitializeDocumentStore();
            LogManager.GetCurrentClassLogger().Info("Started Raccoon Blog");

            ModelBinders.Binders.Add(typeof(CommentCommandOptions), new RemoveSpacesEnumBinder());
            ModelBinders.Binders.Add(typeof(Guid), new GuidBinder());

            DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();

            AutoMapperConfiguration.Configure();

            RavenController.DocumentStore = DocumentStore;
            TaskExecutor.DocumentStore    = DocumentStore;

            // In case the versioning bundle is installed, make sure it will version
            // only what we opt-in to version
            using (var s = DocumentStore.OpenSession())
            {
                s.Store(new
                {
                    Exclude = true,
                    Id      = "Raven/Versioning/DefaultConfiguration",
                });
                s.SaveChanges();
            }
        }
예제 #2
0
        protected void Application_Start()
        {
            // Start unity
            var unityContainer = UnityHelper.Start();

            // Register routes
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);

            GlobalConfiguration.Configure(RegAPI);

            GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(unityContainer);

            RegisterRoutes(RouteTable.Routes);

            // Run scheduled tasks
            ScheduledRunner.Run(unityContainer);

            // Register Data annotations
            DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();

            // Store the value for use in the app
            Application["Version"] = AppHelpers.GetCurrentVersionNo();

            // If the same carry on as normal
            LoggingService.Initialise(ConfigUtils.GetAppSettingInt32("LogFileMaxSizeBytes", 10000));
            LoggingService.Error("START APP");

            // Set default theme
            var defaultTheme = "Metro";

            // Only load these IF the versions are the same
            if (AppHelpers.SameVersionNumbers())
            {
                // Get the theme from the database.
                defaultTheme = SettingsService.GetSettings().Theme;

                // Do the badge processing
                using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
                {
                    try
                    {
                        BadgeService.SyncBadges();
                        unitOfWork.Commit();
                    }
                    catch (Exception ex)
                    {
                        LoggingService.Error(string.Format("Error processing badge classes: {0}", ex.Message));
                    }
                }
            }

            // Set the view engine
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new ForumViewEngine(defaultTheme));

            // Initialise the events
            EventManager.Instance.Initialize(LoggingService);
        }
예제 #3
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     IoCManager.Configure();
     ControllerBuilder.Current.SetControllerFactory(new IoCControllerFactory());
     // Register Data annotations
     DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();
 }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

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

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());

            DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();
        }
예제 #5
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            // WebApiConfig.Register(GlobalConfiguration.Configuration);
            System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            //This should be called once in the application live
            WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "Email", autoCreateTables: true);

            // Start unity
            var unityContainer = UnityHelper.Start();

            // Run scheduled tasks
            ScheduledRunner.Run(unityContainer);

            // Register Data annotations
            DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();

            // Set default theme
            var defaultTheme = "Metro";

            // Get the theme from the database.
            defaultTheme = SettingsService.GetSettings().Theme;

            // Do the badge processing
            using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
            {
                try
                {
                    BadgeService.SyncBadges();
                    unitOfWork.Commit();
                }
                catch (Exception exception)
                {
                    LoggingService.Error(string.Format("Error processing badge classes: {0}", exception.Message));

                    LogService logservice = new LogService();
                    logservice.WriteError(exception.Message, exception.Message, exception.StackTrace, exception.Source);
                }
            }

            // Initialise the events
            EventManager.Instance.Initialize(LoggingService);
        }
예제 #6
0
        public override void Boot(RouteCollection routes)
        {
            base.Boot(routes);

            //we requrie that a custom GlobalFilter is added so see if it is there:
            if (!GlobalFilters.Filters.ContainsFilter <ProxyableResultAttribute>())
            {
                GlobalFilters.Filters.Add(new ProxyableResultAttribute());
            }

            routes.RegisterArea(_installRegistration);
            //register all component areas
            foreach (var c in _componentAreas)
            {
                routes.RegisterArea(c);
            }

            //IMPORTANT: We need to register the Rebel area after the components because routes overlap.
            // For example, a surface controller might have a url of:
            //   /Rebel/MyPackage/Surface/MySurface
            // and because the default action is 'Index' its not required to be there, however this same route
            // matches the default Rebel back office route of Rebel/{controller}/{action}/{id}
            // so we want to make sure that the plugin routes are matched first
            routes.RegisterArea(_areaRegistration);

            //ensure that the IAttributeTypeRegistry is set
            AttributeTypeRegistry.SetCurrent(_attributeTypeRegistry);

            //register validation extensions
            DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();

            LocalizationWebConfig.RegisterRoutes(routes, _settings.RebelPaths.LocalizationPath);

            //If this is outside of an ASP.Net application (i.e. Unit test) and RegisterVirtualPathProvider is called then an exception is thrown.
            if (HostingEnvironment.IsHosted)
            {
                HostingEnvironment.RegisterVirtualPathProvider(new EmbeddedViewVirtualPathProvider());
                HostingEnvironment.RegisterVirtualPathProvider(new CodeDelegateVirtualPathProvider());
            }

            //register custom validation adapters
            DataAnnotationsModelValidatorProvider.RegisterAdapterFactory(
                typeof(HiveIdRequiredAttribute),
                (metadata, controllerContext, attribute) =>
                new RequiredHiveIdAttributeAdapter(metadata, controllerContext, (HiveIdRequiredAttribute)attribute));
        }
예제 #7
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            new RouteConfigurator(RouteTable.Routes).Configure();

            InitializeDocumentStore();
            LogManager.GetCurrentClassLogger().Info("Started Raccoon Blog");

            ModelBinders.Binders.Add(typeof(CommentCommandOptions), new RemoveSpacesEnumBinder());
            ModelBinders.Binders.Add(typeof(Guid), new GuidBinder());

            DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();

            AutoMapperConfiguration.Configure();
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            RaccoonController.DocumentStore = DocumentStore;
            TaskExecutor.DocumentStore      = DocumentStore;

            JobManager.JobException += JobExceptionHandler;
            JobManager.Initialize(new SocialNetworkIntegrationJobsRegistry());
        }
 public static void Start()
 {
     DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();
 }
 public static void Start()
 {
     DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();
     ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
 }
예제 #10
0
 public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     //http://stackoverflow.com/questions/16323591/define-regular-expression-validation-for-custom-datatype-in-mvc4 need this else js validator wont fire
     DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(UmbracoLocalisedRegularExpression), typeof(RegularExpressionAttributeAdapter));
     DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();
 }