RazorEmail
RazorEmail copied to clipboard
API show allow you to use a custom ITemplateResolver
It would make testing in LINQPad possible, not to mention the ability to use dependency injection.
Are you open to refactoring the code so that there is also a BuildService which is constructed?
Always open to refactoring . Can you provide a code example of how you would like to use the api?
I haven't looked at the code base in depth but I was thinking something like:
ITemplateLoader which is an interface that allows the engine to load templates. The default implementation would inject a default implementation ITemplateResolver.
Then there would be a BuildService that injects an ITemplateLoader and can build emails.
This would allow the following use cases plus backwards compatibility:
- Use Injection of
BuildServicein own code with a custom binding ofITemplateLoaderto say, load templates from a DB - Use Injection of
BuildServicein own code with a custom ofITemplateResolverto use a custom way to locate the template on disk - For compatibility, in your static methods, you would construct the default versions of the above and leave them as-is
Thoughts?
https://github.com/markkemper1/RazorEmail/pull/4