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

            foreach (var razorViewEngine in razorViewEngines)
            {
                viewEngines.Insert(0, new ExperienceEditorViewEngine(razorViewEngine));
            }
        }
Пример #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);
        }
Пример #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);
            }
        }
Пример #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));
        }
 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);
 }
Пример #7
0
 public static void LoadPrecompiledViews(ViewEngineCollection engines)
 {
     SparkViewFactory factory = engines.OfType<SparkViewFactory>().First();
     factory.Engine.LoadBatchCompilation(Assembly.Load("Precompiled"));
 }
Пример #8
0
        public static void LoadPrecompiledViews(ViewEngineCollection engines)
        {
            SparkViewFactory factory = engines.OfType <SparkViewFactory>().First();

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