Spark SetPageBaseType 设置中应包含哪些内容
我使用 Spark 直接从控制台应用程序输出一些 HTML。我的项目中有以下视图类。
//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; }
}
然后,我对 Spark 进行了以下设置,
var settings = new SparkSettings()
.SetPageBaseType(typeof(ApplicationView )) //What should go in here!?
.AddNamespace("SomeNameSpaces")
;
当我没有将 ApplicationView 作为 SetPageBaseType 时,我现在不断收到 CompilerException - 我不应该在那里拥有我的共享基础视图吗?
我尝试使用相同的引擎实例将多个不同的视图写入磁盘(具有不同的视图模型),然后我必须为每个具有不同的 SetPageBaseType 的引擎实例设置一个引擎实例(对于我正在渲染的当前视图) - 应该这样吗是这样吗?
基本上我需要上述方面的帮助以及 SetPageBaseType 的一般解释以及如何使用它。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过直接更改引擎的设置属性的设置来更改每个视图的 PageBaseType。
我不久前为这个过程编写了一个简单的包装器......你可以找到它
You can change the PageBaseType per view by changing the setting directly off the engine's Setting property.
I wrote a simple wrapper for this process awhile back... you can find it here if you are interested.