Beispiel #1
0
        public static void RegisterViewEngine(ViewEngineCollection engines)
        {
            var settings = new SparkSettings();

            settings.SetDebug(true);
            engines.Add(new SparkViewFactory(settings));
        }
        private static ISparkSettings GetSparkSettings(Assembly callingAssembly)
        {
            var sparkSettings = new SparkSettings();

            sparkSettings.AddAssembly(callingAssembly);

#if DEBUG
            sparkSettings.SetDebug(true);
#endif

            sparkSettings.SetAutomaticEncoding(false);
            sparkSettings.NullBehaviour = NullBehaviour.Strict;

            return(sparkSettings);
        }
Beispiel #3
0
        protected override void OnApplicationStarted()
        {
            Error      += OnError;
            EndRequest += OnEndRequest;

            var settings = new SparkSettings()
                           .AddNamespace("System")
                           .AddNamespace("System.Collections.Generic")
                           .AddNamespace("System.Web.Mvc")
                           .AddNamespace("System.Web.Mvc.Html")
                           .AddNamespace("MvcContrib.FluentHtml")
                           .AddNamespace("CodeBetter.Canvas")
                           .AddNamespace("CodeBetter.Canvas.Web")
                           .SetPageBaseType("ApplicationViewPage")
                           .SetAutomaticEncoding(true);

#if DEBUG
            settings.SetDebug(true);
#endif
            var viewFactory = new SparkViewFactory(settings);
            ViewEngines.Engines.Add(viewFactory);
#if !DEBUG
            PrecompileViews(viewFactory);
#endif

            RegisterAllControllersIn("CodeBetter.Canvas.Web");

            log4net.Config.XmlConfigurator.Configure();
            RegisterRoutes(RouteTable.Routes);

            Factory.Load(new Components.WebDependencies());
            ModelBinders.Binders.DefaultBinder = new Binders.GenericBinderResolver(Factory.TryGet <IModelBinder>);

            ValidatorConfiguration.Initialize("CodeBetter.Canvas");
            HtmlValidationExtensions.Initialize(ValidatorConfiguration.Rules);
        }