1
Vote

(Bug) MvcWebRazorHostFactory not executing

description

I have created my own MvcWebRazorHostFactory so that I can drive NamespaceImports and such but the code never fires when I use this engine. It does when I use the default engine.

Code:
namespace Testing
{
public class CustomWebRazorostFactory : MvcWebRazorHostFactory
{
    public override WebPageRazorHost CreateHost(string virtualPath, string physicalPath)
    {
        WebPageRazorHost host = base.CreateHost(virtualPath, physicalPath);
        host.NamespaceImports.Clear();
        return host;
    }
}
}

Web.Config:
<system.web.webPages.razor>
<host factoryType="Testing.CustomWebRazorostFactory, Testing" />
</system.web.webPages.razor>

comments