Getting a list of Spark Descriptors for precompiling spark views
I'm trying to get spark precompilation to work and going through the docs, I can see this:
engine.BatchCompilation(targetPath, Global.AllKnownDescriptors());
It doesn't look like the Global.AllKnownDescriptors() is a helper method that is included with the spark dll's so I was wondering how I wou开发者_StackOverflow中文版ld go about getting a list of the SparkViewDescriptor
classes that I need to pass in to enable batch compilation.
The AllKnownDescriptors()
method comes from a MediumTrustHosting sample and the method literally just does this:
public static IList<SparkViewDescriptor> AllKnownDescriptors()
{
return new[]
{
Desc("home.spark", "master.spark"),
Desc("product.spark", "master.spark"),
Desc("productlist.spark", "master.spark"),
};
}
So you can see that it's just an oversimplification but the theory is that you could reflect over your code to find all types that inherit from SparkViewDescriptor
or alternatively keep a registry of sorts manually or in an IoC Container so that you can pass them in for precompilation.
精彩评论