Default Namespaces for RazorLight
I'm trying to setup the FluentEmail Razor Renderer but getting a bunt of errors due to missing default namespaces. For example
The type or namespace name 'List<>' could not be found
Is there a way to configure the default namespaces that the RazorLight engine uses?
I'm getting the same runtime exceptions, my code example is attempting to render a model that has a List<>
The Page (.cshtml) to be rendered by RazorLight is like this:
@using RazorLight
@inherits TemplatePage<List<MyModel>>
@{
Layout = "<namespace path of layout.cshtml>";
}
@foreach (var element in Model)
{
// Html Rendering
}
Per @ryburn52 's Q, do we need to add any additional declaration for this to work?
@Simonl9l I ended up debugging this and their was a limitation with the Razor Light Library and the current FluentEmail implementation. we ended up using a different library
Details can be found here https://github.com/toddams/RazorLight/issues/387
@ryburn52 - thanks for the pointer.
@lukencode - Hi there, per above, don't suppose there are any plans to resolve the issue identified in detail by @ryburn52 ?
As a work around it seem if one embeds the List<Model> as a property in another model and use that in the TemplatePage<Model> things seem to work, the cost of another level of indirection is not entity ideal is workable, and may at least help others in a similar scenario.