Esempio n. 1
0
        protected override void OnBeforeCompilePath(CompilingPathEventArgs args)
        {
            base.OnBeforeCompilePath(args);

            if (!(args.Host is RazorHost))
            {
                args.Host = RazorHost.CreateFromAnother(args.Host);
            }
        }
Esempio n. 2
0
        protected override System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig()
        {
            var host = base.GetHostFromConfig();

            if (!(host is RazorHost))
            {
                host = RazorHost.CreateFromAnother(host);
            }

            return(host);
        }
Esempio n. 3
0
        public static RazorHost CreateFromAnother(System.Web.WebPages.Razor.WebPageRazorHost host)
        {
            var newHost = new RazorHost(host.VirtualPath, host.PhysicalPath);                         //

            newHost.DefaultBaseClass           = typeof(TraceViewPage <>).FullName.Replace("`1", ""); //
            newHost.DefaultClassName           = host.DefaultClassName;
            newHost.DefaultDebugCompilation    = host.DefaultDebugCompilation;
            newHost.DefaultPageBaseClass       = typeof(TraceViewPage <>).FullName.Replace("`1", "");
            newHost.DesignTimeMode             = host.DesignTimeMode;
            newHost.EnableInstrumentation      = host.EnableInstrumentation;
            newHost.GeneratedClassContext      = host.GeneratedClassContext;
            newHost.InstrumentedSourceFilePath = host.InstrumentedSourceFilePath;
            newHost.IsIndentingWithTabs        = host.IsIndentingWithTabs;
            newHost.TabSize = host.TabSize;

            foreach (string current in host.NamespaceImports)
            {
                newHost.NamespaceImports.Add(current);
            }

            return(newHost);
        }