Exemple #1
0
 public static void RegisterViewEngines(ViewEngineCollection viewEngines)
 {
     // 清除所有 View Engine
     viewEngines.Clear();
     // 重新註冊 RazorViewEngine,如果你使用的是 WebForm ViewEngine 則是加入 WebFormViewEngine
     viewEngines.Add(new CSharpRazorViewEngine());
 }
 public static void RegisterViewEngines(ViewEngineCollection viewEngines)
 {
     // 清除所有 View Engine
     viewEngines.Clear();
     // 重新註冊 RazorViewEngine,如果你使用的是 WebForm ViewEngine 則是加入 WebFormViewEngine
     viewEngines.Add(new RazorViewEngine());
 }
Exemple #3
0
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            viewEngines.Clear();
            var CustomRazorViewEngine = new CustomRazorViewEngine();

            viewEngines.Add(CustomRazorViewEngine);
        }
        public static void Register(ViewEngineCollection viewEngines)
        {
            var engine = new MvcFoldersRazorViewEngine("Controllers");

            viewEngines.Clear();
            viewEngines.Add(engine);
        }
        public static void RegisterViewEngines(ViewEngineCollection viewEngines)
        {
            viewEngines.Clear();

            var lightweightRazorViewEngine = new LightweightRazorViewEngine();
            viewEngines.Add(lightweightRazorViewEngine);
        }
Exemple #6
0
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            viewEngines.Clear();

            var PMIViewEngine = new PMIViewEngine();

            viewEngines.Add(PMIViewEngine);
        }
        private void registerViewEngines()
        {
            ViewEngineCollection viewEngines = container.Resolve <ViewEngineCollection>();

            viewEngines.Clear();

            viewEngines.Add(container.Resolve <OxiteWebFormViewEngine>());
        }
Exemple #8
0
 public static void RegisterViewEngines(ViewEngineCollection viewEngines)
 {
     viewEngines.Clear();
     viewEngines.Add(new RazorViewEngine());
     viewEngines.Add(new LoggingViewEngine.LoggingViewEngine());
     viewEngines.Add(new PdfViewEngine.PdfViewEngine());
     viewEngines.Add(new MailerViewEngine.MailerViewEngine());
 }
Exemple #9
0
 public static void RegisterViewEngines(ViewEngineCollection viewEngines)
 {
     viewEngines.Clear();
     viewEngines.Add(new RazorViewEngine());
     viewEngines.Add(new LoggingViewEngine.LoggingViewEngine());
     viewEngines.Add(new PdfViewEngine.PdfViewEngine());
     viewEngines.Add(new MailerViewEngine.MailerViewEngine());
 }
Exemple #10
0
        /// <summary>
        /// Regist view engines only needed
        /// </summary>
        /// <param name="enginCollection">ViewEnginCollection</param>
        public static void RegisterViewEngines(ViewEngineCollection enginCollection)
        {
            //// clear all render engine
            enginCollection.Clear();

            //// accept only Razor render engine
            enginCollection.Add(new RazorViewEngine());
        }
        private static void UseCustomViewEngine(ViewEngineCollection viewEngines)
        {
            var settings   = new ControllerPathSettings(mergeNameIntoNamespace: false);
            var viewEngine = new ControllerPathRazorViewEngine(settings);

            viewEngines.Clear();
            viewEngines.Add(viewEngine);
        }
        public static void RegisterEngines(ViewEngineCollection viewEngines)
        {
            // Removes WebForms view engine - optimization
            viewEngines.Clear();

            // viewEngines.Add(new CustomViewLocationRazorViewEngine());
            viewEngines.Add(new RazorViewEngine());
        }
Exemple #13
0
 /// <summary>
 /// 注册视图引擎
 /// </summary>
 public static void RegisterViewEngines(ViewEngineCollection engines)
 {
     engines.Clear();
     //engines.Add(new NVelocityViewEngine());
     //engines.Add(new MicuaRazorViewEngine());
     foreach (var item in ViewEngines)
     {
         engines.Insert(0, item);
     }
 }
Exemple #14
0
        /// <summary>
        /// Wraps existing view engines with ViewTrackerRazorEngine.
        /// </summary>
        /// <param name="application">Mvc Application</param>
        /// <param name="viewEngines">View Engines</param>
        public void StartTracking(HttpApplication application, ViewEngineCollection viewEngines)
        {
            _viewUsage = new ConcurrentDictionary <string, ulong>(_directoryHelper
                                                                  .GetFiles(HostingEnvironment.ApplicationPhysicalPath, "*.cshtml", SearchOption.AllDirectories)
                                                                  .ToDictionary(f => f, _ => (ulong)0));
            var engines = viewEngines.Select(v => new ViewTrackerRazorEngine(v, this)).ToList();

            viewEngines.Clear();
            engines.ForEach(viewEngines.Add);
        }
Exemple #15
0
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            // We do not need the default view engine
            viewEngines.Clear();

            var templateableRazorViewEngine = new TemplateWebformViewEngine {
                CurrentTemplate = httpContext => httpContext.Request["template"] as string ??  string.Empty
            };

            viewEngines.Add(templateableRazorViewEngine);
        }
Exemple #16
0
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            viewEngines.Clear();

            var themeableRazorViewEngine = new ThemeableRazorViewEngine
            {
                CurrentTheme = httpContext => httpContext.Session["theme"] as string ?? string.Empty
            };

            viewEngines.Add(themeableRazorViewEngine);
        }
Exemple #17
0
        public static void RegisterViewEngines(ViewEngineCollection engines)
        {
            var engine = new MobileCapableWebFormViewEngine();
            engine.DeviceFolders.Clear();
            engine.DeviceFolders.Add("Mozilla", "iPhone");
            engine.DeviceFolders.Add("Safari", "iPhone");
            engine.DeviceFolders.Add("Chrome", "iPhone");

            engines.Clear();
            engines.Add(engine);
        }
        public static void Install(ViewEngineCollection engines)
        {
            if (engines == null)
                throw new ApplicationException("ViewEngines.Engines Found");

            var sparkSettings = GetSparkSettings(Assembly.GetCallingAssembly());
            var sparkViewFactory = new SparkViewFactory(sparkSettings);

            engines.Clear();
            engines.Add(sparkViewFactory);
        }
        public static void RegisterViewEngines(ViewEngineCollection engines)
        {
            var engine = new Application.MVCExtensions.Mobile.MobileCapableRazorViewEngine();

            engine.DeviceFolders.Clear();

            engine.MobileOverrideQueryStringParam = "M2W";

            engines.Clear();
            engines.Add(engine);
        }
Exemple #20
0
        private static void RegisterViewEngines(ViewEngineCollection engines)
        {
            //WebViewPageConfig.CdnEnabled = false;
            //WebViewPageConfig.ThemeEnabled = true;
            //ThemeLogger.Enabled = true;

            //replace
            engines.Clear();
            engines.Add(new ThemeableRazorViewEngine());
            //not replace
            //engines.Insert(0, new ThemeableRazorViewEngine());
        }
Exemple #21
0
        public static void RegisterViewEngines(ViewEngineCollection engines)
        {
            var engine = new MobileCapableWebFormViewEngine();

            engine.DeviceFolders.Clear();
            engine.DeviceFolders.Add("Mozilla", "iPhone");
            engine.DeviceFolders.Add("Safari", "iPhone");
            engine.DeviceFolders.Add("Chrome", "iPhone");

            engines.Clear();
            engines.Add(engine);
        }
Exemple #22
0
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            // We do not need the default view engine
            viewEngines.Clear();

            var themeableRazorViewEngine = new ThemeableRazorViewEngine
            {
                CurrentTheme = httpContext =>
                {
                    if (httpContext.Session == null)
                    {
                        return("");
                    }

                    string theme = "";

                    if (httpContext.Session != null && httpContext.Session["theme"] != null && (string)httpContext.Session["theme"] != "")
                    {
                        theme = httpContext.Session["theme"].ToString();
                    }
                    else
                    {
                        var Db = AppHost.Resolve <IDbConnection>();
                        if (Db != null && Db.State != ConnectionState.Open)
                        {
                            Db = AppHost.Resolve <IDbConnectionFactory>().Open();
                        }

                        var request = HttpContext.Current.Request;
                        var host    = request.Url.Scheme;
                        host += "://";
                        host += request.Url.Authority;

                        var websites = Db.Where <Website>(m => m.Status == 1);

                        var ret = websites.Where(m => m.IsValidDomain(host) || m.IsValidDomain(request.Url.Authority)).FirstOrDefault();
                        theme = "";
                        if (ret != null)
                        {
                            theme = ret.Theme;
                        }
                        httpContext.Session.Add("theme", theme);

                        //
                        Db.Close();
                    }

                    return(theme);
                }
            };

            viewEngines.Add(themeableRazorViewEngine);
        }
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            // We do not need the default view engine
            viewEngines.Clear();

            var themeableRazorViewEngine = new ThemeableRazorViewEngine
                                               {
                                                   CurrentTheme = httpContext => httpContext.Session["theme"] as string ?? string.Empty
                                               };

            viewEngines.Add(themeableRazorViewEngine);
        }
        public static void Initialize()
        {
            ViewEngineCollection engines = ViewEngines.Engines;

            engines.Clear();
            engines.Add(new ModularWebFormViewEngine());
            engines.Add(new ModularRazorViewEngine());

            ModuleAreaRegistration.RegisterAllModuleAreas();
            ModuleRegistration.RegisterAllModules();
            AreaRegistration.RegisterAllAreas();
        }
Exemple #25
0
        public void Execute(IDictionary <string, object> state)
        {
            ViewEngineCollection viewEngines = container.Resolve <ViewEngineCollection>();

            viewEngines.Clear();

            viewEngines.Add(container.Resolve <IViewEngine>());

            foreach (IViewEngine viewEngine in container.ResolveAll <IViewEngine>())
            {
                ViewEngines.Engines.Add(viewEngine);
            }
        }
        public static void Install(ViewEngineCollection engines)
        {
            if (engines == null)
            {
                throw new ApplicationException("ViewEngines.Engines Found");
            }

            var sparkSettings    = GetSparkSettings(Assembly.GetCallingAssembly());
            var sparkViewFactory = new SparkViewFactory(sparkSettings);

            engines.Clear();
            engines.Add(sparkViewFactory);
        }
Exemple #27
0
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            // mevcut engineleri temizliyoruz.
            viewEngines.Clear();

            var basePath  = ConfigurationManager.AppSettings["ThemeBasePath"];
            var themeName = ConfigurationManager.AppSettings["ThemeName"];

            var theme = new ThemeModel(basePath, themeName);

            var themeableRazorViewEngine = new ThemeRazorViewEngine(theme);

            viewEngines.Add(themeableRazorViewEngine);
        }
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            // We do not need the default view engine

            viewEngines.Clear();

            var basePath = ConfigurationManager.AppSettings["ThemeBasePath"];
            var themeName = ConfigurationManager.AppSettings["ThemeName"];

            var theme = new Theme(basePath,themeName);

            var themeableRazorViewEngine = new ThemedRazorViewEngine(theme);

            viewEngines.Add(themeableRazorViewEngine);
        }
Exemple #29
0
        public static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            //// We do not need the default view engine
            viewEngines.Clear();

            //var adminTemplateRazorViewEngine = new AdminTemplateRazorViewEngine {
            //    CurrentTemplate = httpContext => httpContext.Session["theme"] as string
            //};

            //viewEngines.Add(adminTemplateRazorViewEngine);

            var templateRazorViewEngine = new TemplateRazorViewEngine {
                CurrentTemplate = httpContext => httpContext.Session["theme"] as string
            };

            viewEngines.Add(templateRazorViewEngine);
        }
Exemple #30
0
        private static void RegisterViewEngine(ViewEngineCollection viewEngines)
        {
            RazorViewEngine viewRngine = new RazorViewEngine()
            {
                MasterLocationFormats = new[]
                {
                    "~/Views/{1}/{0}.master", "~/Views/{0}.master"
                },
                ViewLocationFormats = new[]
                {
                    "~/Views/{1}/{0}.aspx", "~/Views/{1}/{0}.ascx",
                    "~/Views/{0}.aspx", "~/Views/{0}.ascx"
                },
                PartialViewLocationFormats = new[]
                {
                    "~/Views/{1}/{0}.aspx", "~/Views/{1}/{0}.ascx",
                    "~/Views/{0}.aspx", "~/Views/{0}.ascx"
                }
            };

            viewEngines.Clear();
            viewEngines.Add(viewRngine);
        }
Exemple #31
0
 public void RegisterViewEngines(ViewEngineCollection engines)
 {
     engines.Clear();
     engines.Add(new ZptViewEngine());
 }
 private static void AddFeatureViewViewEngine(ViewEngineCollection views)
 {
     views.Clear();
     views.Add(new FeatureViewLocationRazorViewEngine());
 }
Exemple #33
0
 public static void RegisterEngines(ViewEngineCollection engines)
 {
     engines.Clear();
     engines.Add(new RazorViewEngineCustom());
     engines.Add(new WebFormViewEngineCustom());
 }
 public static void Register(ViewEngineCollection engines)
 {
     engines.Clear();
     engines.Add(new RazorViewEngine());
 }
 internal static void RegisterViewEngine(ViewEngineCollection viewEngineCollection, IViewEngine viewEngine)
 {
     viewEngineCollection.Clear();
     viewEngineCollection.Add(viewEngine);
 }
 internal static void RegisterViewEngine(ViewEngineCollection viewEngineCollection, IViewEngine viewEngine)
 {
     viewEngineCollection.Clear();
     viewEngineCollection.Add(viewEngine);
 }
 internal static void RegisterViewEngines(ViewEngineCollection viewEngineCollection)
 {
     viewEngineCollection.Clear();
     viewEngineCollection.Add(new RazorViewEngine());
 }
Exemple #38
0
 /// <summary>
 ///     Configures the view engines. By default, Asp.Net MVC includes the Web Forms (WebFormsViewEngine) and
 ///     Razor (RazorViewEngine) view engines that supports both C# (.cshtml) and VB (.vbhtml). You can remove view
 ///     engines you are not using here for better performance and include a custom Razor view engine that only
 ///     supports C#.
 /// </summary>
 private static void ConfigureViewEngines(ViewEngineCollection viewEngines)
 {
     viewEngines.Clear();
     viewEngines.Add(new RazorViewEngine()); // NOTE: Boilerplate.Web.Mvc5.CSharpRazorViewEngine is .cshtml only optimization.
 }
Exemple #39
0
 public static void RegisterViewEngines(ViewEngineCollection viewEngines)
 {
     viewEngines.Clear();
     viewEngines.Add(new CustomViewLocationRazorViewEngine());
 }
 protected virtual void RegisterViewEngines(ViewEngineCollection viewEngines, 
     IDictionary<string, Type> precompiledViews)
 {
     IViewEngine razor = null, webForms = null;
     foreach (IViewEngine engine in viewEngines)
     {
         if (engine is RazorViewEngine)
             razor = engine;
         if (engine is WebFormViewEngine)
             webForms = engine;
     }
     viewEngines.Clear();
     if ((SpaApp.Config.ViewEngines & Engines.RazorViewEngine) == Engines.RazorViewEngine && razor != null)
         viewEngines.Add(razor);
     if ((SpaApp.Config.ViewEngines & Engines.WebFormViewEngine) == Engines.WebFormViewEngine && webForms != null)
         viewEngines.Add(webForms);
     if ((SpaApp.Config.ViewEngines & Engines.PrecompiledViewEngine) == Engines.PrecompiledViewEngine)
         viewEngines.Add(new PrecompiledViewEngine(precompiledViews));
 }
 public static void Set(this ViewEngineCollection viewEngines, RazorViewEngine engine)
 {
     viewEngines?.Clear();
     viewEngines.Add(engine);
 }
Exemple #42
0
 public static void RegisterViewEngines(ViewEngineCollection viewEngines)
 {
     viewEngines.Clear();
     viewEngines.Add(new MultiRazorViewEngine());
 }
Exemple #43
0
        internal static void RegisterViews(ViewEngineCollection viewEngines)
        {
            viewEngines.Clear();

            viewEngines.Add(new RazorViewEngine());
        }
Exemple #44
0
 public static void RegisterViewEngines(ViewEngineCollection viewEngines) {
     viewEngines.Clear();
     viewEngines.Add(new RazorViewEngine());
 }
 public static void Register(ViewEngineCollection engines)
 {
     engines.Clear();
     engines.Add(new RazorViewEngine());
 }
 public static void RegisterViewEngines(ViewEngineCollection viewEngineCollection)
 {
     viewEngineCollection.Clear();
     viewEngineCollection.Add(new RazorViewEngine());
 }
 private void RegisterViewEngines(ViewEngineCollection viewEngineCollection)
 {
     viewEngineCollection.Clear();
     viewEngineCollection.Add(new RazorViewEngine());
 }