RazorGeneratorMvcStart.cs 693 B

123456789101112131415161718192021
  1. using System.Web;
  2. using System.Web.Mvc;
  3. using System.Web.WebPages;
  4. using RazorGenerator.Mvc;
  5. [assembly: WebActivatorEx.PostApplicationStartMethod(typeof(EMIS.Web.RazorGeneratorMvcStart), "Start")]
  6. namespace EMIS.Web {
  7. public static class RazorGeneratorMvcStart {
  8. public static void Start() {
  9. var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) {
  10. UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
  11. };
  12. ViewEngines.Engines.Insert(0, engine);
  13. // StartPage lookups are done by WebPages.
  14. VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
  15. }
  16. }
  17. }