【发布时间】:2011-11-12 14:58:05
【问题描述】:
我正在尝试使用 TinyWeb 框架和 Spark 视图引擎呈现一个简单的视图。
环境是 Visual Studio 2011 开发者预览版和 .net 4.5
渲染没有模型绑定的模板可以正常工作。 但是,当我绑定模型时,它就不再起作用了。
我收到此错误: 当前上下文中不存在名称“模型”。
处理程序:
public class IndexHandler
{
Route route = new Route("/");
public IResult Get()
{
var model = new { message = "Hello World" };
return View.Spark(model, "Views/base.spark");
}
}
查看:
<html>
<head>
<title>This is a test</title>
</head>
<body>
<p>${Model.message}</p>
</body>
</html>
【问题讨论】:
标签: c# .net spark-view-engine tinyweb