开发者

What to put in Spark SetPageBaseType setting

I use Spark to output some HTML straight from a console app. I have the following view classes in my project.

//A shared view that all other views should use
public abstract class SharedView : AbstractSparkView
{
    public string BasePath = string.Empty;
}

public abstract class ApplicationView : SharedView
{
    public Application Application { get; set; }
} 

I then have the following setting for Spark

var settings = new开发者_Go百科 SparkSettings()
            .SetPageBaseType(typeof(ApplicationView )) //What should go in here!?
            .AddNamespace("SomeNameSpaces")
            ;

I now keep getting a CompilerException when I not put the ApplicationView as the SetPageBaseType - shouldn't I have my shared base view there?

I try to use the same engine instance to write several different views to disk (with diffrent view models) and I then have to set up a engine instance for each one with diffrent SetPageBaseType (for the current view I'm rendering)- should that be so?

Bascially I need help with above and a general explanation of SetPageBaseType and how to use it.


You can change the PageBaseType per view by changing the setting directly off the engine's Setting property.

engine.Settings.PageBaseType = typeof(ApplicationView).FullName;

I wrote a simple wrapper for this process awhile back... you can find it here if you are interested.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜