lai
January 5, 2019, 8:51pm
1
I have a templates .html page that calls a TemplateCodePage however I’m gettting an exception message
“Partial was not found: ‘reminder’”
this is my .html file
<h3>Document Reminder</h3>
<p class="sub-info">
{{'reminder' | partial({userDocumentReminder: userDocumentReminder})}}
</p>
and this is the TemplateCodePage (with the render content omitted)
[Page("reminder")]
public class UserDocumentRemindersPage : TemplateCodePage
{
string render(UserDocumentReminder userDocumentReminder) => $@";
}
The documentation suggests that the TemplateCodePages are scanned for and added when the plugin is added, how can I verify this?
Thanks
mythz
January 6, 2019, 3:50am
2
Only the ServiceHost assembly is scanned, if it’s in a different assembly you’ll need to specify either the Type in ScanTypes collection or the Assembly where it’s located in the ScanAssemblies collection, see the examples in the filter registration docs for reference:
http://templates.servicestack.net/docs/filters
lai
January 6, 2019, 1:38pm
3
Thanks, that worked.
I was just wondering is executing the code below inefficient every time I want to refer to an email html template?
var templateContext = new TemplateContext
{
VirtualFiles = base.VirtualFiles,
ScanAssemblies = {typeof(UserDocumentRemindersPage).Assembly}
}.Init();
mythz
January 6, 2019, 2:45pm
4
That code scans the assembly looking for types, if you use ScanTypes instead it won’t do any Assembly scanning.