I'm getting a YSOD when sending a model of type IEnumerable<string>
to my Razor view in NancyFX. Everything works well if supply a string as the model, with the relevant @model
statement in the view, so its working.
The error is
Unable to discover CLR Type for model by the name of System.Collections.Generic.IEnumerable. Ensure that the model passed to the view is assignable to the model declared in the view.
What have I missed?
View.cshtml
@model System.Collections.Generic.IEnumerable<System.String>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1></h1>
@foreach (var item in Model)
{
<h3>@item</h3>
}
</body>
</html>
The Module
public class MyModule: NancyModule
{
public MyModule()
{
Get["/"] = parameters => View["View", this.GetModel()];
}
private IEnumerable<string> GetModel()
{
return new[] { "one", "two" };
}
}