3
Vote

documentation on precompilation of views

description

In the page about precompilation, there is an example to load an assembly :
 
http://sparkviewengine.com/documentation/precompiling#Loadingadeployedprecompiledassembly
 
factory.Engine.LoadBatchCompilation(Assembly.Load("MyWebApp.Views.dll"));
 
It's not working but this is correct :
 
factory.Engine.LoadBatchCompilation(Assembly.Load("MyWebApp.Views")); //without dll because the method take the name of the assembly not the file
 
I didn't find the documentation in Git but If there's a way to correct/complete the page, I can fix the issue if I am correct !
 
And it's stated that the tricky part is to hold the instance of the ViewFactory. I do this in my "Start" method :

RegisterViewEngines(ViewEngines.Engines);
 

if RELEASE

        var vfactory = ViewEngines.Engines.FirstOrDefault(vf => vf is SparkViewFactory) as SparkViewFactory;
        if (null != vfactory)
        {
            vfactory.Engine.LoadBatchCompilation(Assembly.Load("MyWebApp.Web.Views"));
        }

endif

 
Again if it's ok to add this as an example ?
 
Matthieu

comments