0
我使用Spark与WPF。这工作正常,我能够格式化模板,并从自定义的DTO(我的模型)拉标量属性。我很难找到循环工作。从看the Spark documentation,我应该能够做到这一点,但我得到的火花例外:For循环Spark视图引擎/ ASP.NET MVC
Dynamic view compilation failed.
c:\Users\Echilon\AppData\Local\Temp\tmp4490.tmp(73,73): error CS0103: The name 'Sections' does not exist in the current context
下面的代码工作在模板细拉从模型中Name
属性:<h1>${Name}</h1>
但for循环生成例外:
<for each="var sect in Sections">
${#sect.Name}
<!-- HTML for each element omitted -->
</for>
您的基本框架命名空间'System。*'和您的通用用户命名空间应该在_global.spark中,Web.config中的spark config部分中声明,或者在构建'SparkViewEngine'时添加到'SparkSettings'中,不必在每个视图文件中重复它们 –