//public static void Start() { // var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { // UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal // }; // ViewEngines.Engines.Insert(0, engine); // // StartPage lookups are done by WebPages. // VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); //} /// <summary> ///Loop through to get the DLL exceptions from reflection Type /// </summary> public static void Start() { PrecompiledMvcEngine engine = null; try { engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; } catch (System.Reflection.ReflectionTypeLoadException e) { StringBuilder exceptions = new StringBuilder("The following DLL load exceptions occurred:"); foreach (var x in e.LoaderExceptions) { exceptions.AppendFormat("{0},\n\n", x.Message); } throw new Exception(string.Format("Error loading Razor Generator Stuff:\n{0}", exceptions)); } ViewEngines.Engines.Insert(0, engine as PrecompiledMvcEngine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine as PrecompiledMvcEngine); }
/// <summary> /// Registers the <see cref="T:RazorGenerator.Mvc.PrecompiledMvcEngine"/> with the application. /// </summary> public static void Start() { PrecompiledMvcEngine engine = null; try { engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; } catch (ReflectionTypeLoadException e) { string exceptions = "The following DLL load exceptions occurred:"; foreach (var x in e.LoaderExceptions) { exceptions += x.Message + ",\n\n"; } throw new Exception("Error loading Razor Generator Stuff:\n" + exceptions); } ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
/// <summary> /// Create the view engine. /// </summary> public static void Init() { // Create new precompiled view engine var engine = new PrecompiledMvcEngine(typeof(ManagerModule).Assembly) { UsePhysicalViewsIfNewer = true }; engine.PartialViewLocationFormats = engine.PartialViewLocationFormats.Union(ExtensionsFolder).ToArray(); var standard = new RazorViewEngine(); standard.PartialViewLocationFormats = standard.PartialViewLocationFormats.Union(ExtensionsFolder).ToArray(); ViewEngines.Engines.Insert(0, standard); ViewEngines.Engines.Insert(1, engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); // Register the manager area var manager = new ManagerRegistration(); var context = new AreaRegistrationContext(manager.AreaName, RouteTable.Routes); manager.RegisterArea(context); // Register custom model binders RegisterBinders(); // Register json deserialization for post data ValueProviderFactories.Factories.Add(new JsonValueProviderFactory()); // Register application part ApplicationPart.Register(new ApplicationPart(typeof(ManagerModule).Assembly, "~/")); }
public void _runMvcEngine() { PrecompiledMvcEngine precompiledMvcEngine = new PrecompiledMvcEngine(mAssemblys); ViewEngines.Engines.Add(precompiledMvcEngine); VirtualPathFactoryManager.RegisterVirtualPathFactory(precompiledMvcEngine); }
/* Eliminated all vbhtml and aspx, and unused locations, and engines*/ private static void SetupRazor() { ViewEngines.Engines.Clear(); var razor = new PrecompiledMvcEngine(typeof(Mvc).Assembly) { UsePhysicalViewsIfNewer = true }; ViewEngines.Engines.Insert(0, razor); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(razor); // Not using areas, not using vbhtmls. var areaViewLocations = new string[0]; var viewLocations = new[] { "~/Views/{1}/{0}.cshtml", "~/Views/Shared/{0}.cshtml" }; razor.AreaMasterLocationFormats = areaViewLocations; razor.AreaPartialViewLocationFormats = areaViewLocations; razor.AreaViewLocationFormats = areaViewLocations; razor.MasterLocationFormats = viewLocations; razor.PartialViewLocationFormats = viewLocations; razor.ViewLocationFormats = viewLocations; ViewEngines.Engines.Add(razor); }
private static void RegisterViewEngines() { // Register the standard view engine var standard = new RazorViewEngine(); standard.PartialViewLocationFormats = standard.PartialViewLocationFormats.Union(partialViewFolders).ToArray(); ViewEngines.Engines.Add(standard); // Get precompiled view assemblies var assemblies = new List <Assembly>(); if (Hooks.App.Init.RegisterPrecompiledViews != null) { Hooks.App.Init.RegisterPrecompiledViews(assemblies); } assemblies.Insert(0, typeof(Startup).Assembly); foreach (var assembly in assemblies) { var engine = new PrecompiledMvcEngine(assembly) { UsePhysicalViewsIfNewer = true }; engine.PartialViewLocationFormats = engine.PartialViewLocationFormats.Union(partialViewFolders).ToArray(); ViewEngines.Engines.Add(engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); } }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(PrecompiledMvcViewEngineStart).Assembly); ViewEngines.Engines.Insert(0, engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(PrecompiledMvcViewEngineStart).Assembly); ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; ViewEngines.Engines.Insert(0, engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void RegisterViewEngines(ViewEngineCollection viewEngines) { var engine = new PrecompiledMvcEngine(typeof(ViewEngineConfig).Assembly) { UsePhysicalViewsIfNewer = MvcApplication.DebugEnvironment }; viewEngines.Insert(0, engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = true }; ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public void Initialize(InitializationEngine context) { var engine = new PrecompiledMvcEngine(typeof(ViewEngineInitializer).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void PostApp(Assembly asm) { var binDir = ConfigurationManager.AppSettings.Get("Dir.WebBin"); if (string.IsNullOrWhiteSpace(binDir)) { MvcResolve.Init(binDir); } // RazorGenearator.Mvc https://github.com/RazorGenerator/RazorGenerator PrecompiledMvcEngine.MvcEngine(asm); }
private void RegisterRazorGeneratorEngine() { var engine = new PrecompiledMvcEngine(typeof(BaseController).Assembly) { //UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = System.Web.HttpContext.Current.Request.IsLocal }; ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); MvcHandler.DisableMvcResponseHeader = true; }
public static void RazorGeneratorMvcInit() { var engineAssemblies = AppDomain.CurrentDomain.GetAssemblies() .Where(assembly => assembly.GetTypes().Any(t => t.BaseType == typeof(ModuleTag))); engineAssemblies.ForEach(assembly => { var engine = new PrecompiledMvcEngine(assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; ViewEngines.Engines.Insert(0, engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }); }
public static void Start() { if (_startMethodExecuted == true) { return; } var engine = new PrecompiledMvcEngine(typeof(MvcSample.PreApplicationStartCode).Assembly); ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); _startMethodExecuted = true; }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; engine.ViewLocationCache = new TwoLevelViewCache(engine.ViewLocationCache); //ViewEngines.Engines.Clear(); //ViewEngines.Engines.Add(engine); ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; if (HttpContext.Current.Request.IsLocal) { ViewEngines.Engines.Add(new RazorViewEngine()); } ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); }
public static void Start() { bool usePrecompiledViews; if (!bool.TryParse(ConfigurationManager.AppSettings["UsePrecompiledViews"] ?? "", out usePrecompiledViews)) { usePrecompiledViews = false; } if (usePrecompiledViews) { // use dynamically compiled views var engine = new PrecompiledMvcEngine(typeof(PrecompiledMvcViewEngineStart).Assembly); ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); } }
protected void Application_Start() { var engine = new PrecompiledMvcEngine(typeof(MvcApplication).Assembly) { UsePhysicalViewsIfNewer = false, PreemptPhysicalFiles = true }; ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); ControllerBuilder.Current.SetControllerFactory(new DependencyControllerFactory()); }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); // ³õʼ»¯¿ò¼Ü App.Init(); App.OperationLogger = (position, target, type, message) => AppSettings.Entrance.Logger(position, target, type, message); WebApiConfigBase.Register(GlobalConfiguration.Configuration); FilterConfigBase.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfigBase.RegisterRoutes(RouteTable.Routes); BundleConfigBase.RegisterBundles(BundleTable.Bundles); }
/// <summary> /// Initializes the application. /// </summary> public static void Init() { // Register precompiled views var assemblies = new List <Assembly>(); // Check if any modules have registered for precompiled views. if (Hooks.RegisterPrecompiledViews != null) { Hooks.RegisterPrecompiledViews(assemblies); } // Create precompiled view engines for all requested modules. foreach (var assembly in assemblies) { var engine = new PrecompiledMvcEngine(assembly) { UsePhysicalViewsIfNewer = true }; ViewEngines.Engines.Add(engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); } }
private static void RegisterRazorGeneratedViewEngine() { var areaNames = RouteTableHelper.GetApplicationAreaNames(); foreach (var areaName in areaNames) { var engine = new PrecompiledMvcEngine(typeof(PizzaMvcPostApplicationStart).Assembly, $"~/Areas/{areaName}/") { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal, }; ViewEngines.Engines.Add(engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); } var mainEngine = new PrecompiledMvcEngine(typeof(PizzaMvcPostApplicationStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal, }; ViewEngines.Engines.Add(mainEngine); VirtualPathFactoryManager.RegisterVirtualPathFactory(mainEngine); }
public static void Start() { var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal }; ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); // regist bundles var jsList = new string[] { "Code.js", "Config.js", "Generator.js", "Menu.js", "Organize.js", "Parameter.js", "Permission.js", "Role.js", "User.js" }; foreach (var js in jsList) { BundleTable.Bundles.Add(new ScriptBundle("~/Resource/Sys/" + js).Include("~/Resource/Zephyr.Web.Sys/Areas/Sys/ViewModels/" + js)); } App.GetDefaultConnectionName = DbCreatorBase.GetDefaultConnectionName; if (AppSettings.Entrance.GetType() == typeof(DefaultWebEntrance)) { AppSettings.Entrance = new SysEntrance(); } }
public static void Start() { if (_startMethodExecuted == true) { return; } var engine = new PrecompiledMvcEngine(typeof(PreApplicationStartCode).Assembly); // If you have multiple assemblies with precompiled views, // use CompositePrecompiledMvcEngine: // //var engine = new CompositePrecompiledMvcEngine( // PrecompiledViewAssembly.OfType<YourType>(), // PrecompiledViewAssembly.OfType<PreApplicationStartCode>( // usePhysicalViewsIfNewer: HttpContext.Current.IsDebuggingEnabled)); ViewEngines.Engines.Insert(0, engine); // StartPage lookups are done by WebPages. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); _startMethodExecuted = true; }