public static void RegisterViewEngines(ViewEngineCollection viewEngines)
        {
            var razorViewEngines = viewEngines.OfType <RazorViewEngine>().Reverse();

            foreach (var razorViewEngine in razorViewEngines)
            {
                viewEngines.Insert(0, new ExperienceEditorViewEngine(razorViewEngine));
            }
        }
Ejemplo n.º 2
0
        private static void ForceViewLocation(ViewEngineCollection viewEngineCollection, string viewLocation)
        {
            var forcedLocViewEngine =
                viewEngineCollection.OfType <ForcedLocationViewEngine>().Select(ve => ve).FirstOrDefault();

            if (forcedLocViewEngine == null)
            {
                forcedLocViewEngine = new ForcedLocationViewEngine();
                viewEngineCollection.Add(forcedLocViewEngine);
            }
            forcedLocViewEngine.SetLocation(viewLocation);
        }
Ejemplo n.º 3
0
        public static void AdjustViewEngines(ViewEngineCollection viewEngines)
        {
            // Turn off WebFormViewEngine. Use Razor only.
            var webformViewEngine = viewEngines.OfType <WebFormViewEngine>().FirstOrDefault();

            if (webformViewEngine != null)
            {
                viewEngines.Remove(webformViewEngine);
            }

            // Activate MvcCodeRouting view wrapper
            viewEngines.EnableCodeRouting();
        }
        /// <summary>
        /// Registers the specified engines.
        /// </summary>
        /// <param name="engines">The engines.</param>
        public static void Register(ViewEngineCollection engines)
        {
            var razorViewEngine = engines
                                  .OfType <RazorViewEngine>()
                                  .FirstOrDefault();

            var contentViewEngine = new ContentViewEngine();

            if (null == razorViewEngine)
            {
                engines.Add(contentViewEngine);
            }
            else
            {
                var index = engines.IndexOf(razorViewEngine);
                engines.Insert(index, contentViewEngine);
            }
        }
Ejemplo n.º 5
0
        /// <summary>The update view engines.</summary>
        /// <param name="engines">The engines.</param>
        private static void UpdateViewEngines(ViewEngineCollection engines)
        {
            var webFormViewEngine = engines.FirstOrDefault(e => e is WebFormViewEngine);

            if (webFormViewEngine != null)
            {
                engines.Remove(webFormViewEngine);
            }

            engines.OfType<RazorViewEngine>().ToList().ForEach(engine =>
                    engine.FilterLocationFormats(
                        e => e.AreaMasterLocationFormats, 
                        e => e.AreaPartialViewLocationFormats, 
                        e => e.AreaViewLocationFormats, 
                        e => e.FileExtensions, 
                        e => e.MasterLocationFormats, 
                        e => e.PartialViewLocationFormats, 
                        e => e.ViewLocationFormats));
        }
Ejemplo n.º 6
0
 private static void ForceViewLocation(ViewEngineCollection viewEngineCollection, string viewLocation)
 {
     var forcedLocViewEngine =
         viewEngineCollection.OfType<ForcedLocationViewEngine>().Select(ve => ve).FirstOrDefault();
     if (forcedLocViewEngine == null)
     {
         forcedLocViewEngine = new ForcedLocationViewEngine();
         viewEngineCollection.Add(forcedLocViewEngine);
     }
     forcedLocViewEngine.SetLocation(viewLocation);
 }
Ejemplo n.º 7
0
 public static void LoadPrecompiledViews(ViewEngineCollection engines)
 {
     SparkViewFactory factory = engines.OfType<SparkViewFactory>().First();
     factory.Engine.LoadBatchCompilation(Assembly.Load("Precompiled"));
 }
Ejemplo n.º 8
0
        public static void LoadPrecompiledViews(ViewEngineCollection engines)
        {
            SparkViewFactory factory = engines.OfType <SparkViewFactory>().First();

            factory.Engine.LoadBatchCompilation(Assembly.Load("Precompiled"));
        }