Interface ITemplateRenderer
- Namespace
- MailStencil
- Assembly
- MailStencil.Core.dll
Renders content with a strongly typed model, without accessing template storage.
public interface ITemplateRenderer
Remarks
Implementations must support concurrent calls and must not mutate the model or culture. This contract can also render unsaved content for preview. The declared model type, including declared nested and collection element types, defines the member contract; runtime subtype members must not be exposed automatically. A null root model is invalid.
Methods
RenderAsync<TModel>(EmailTemplateContent, TModel, CultureInfo, CancellationToken)
Renders all content parts using an explicit formatting culture.
Task<RenderedEmailTemplate> RenderAsync<TModel>(EmailTemplateContent content, TModel model, CultureInfo culture, CancellationToken cancellationToken = default) where TModel : notnull
Parameters
contentEmailTemplateContentmodelTModelcultureCultureInfocancellationTokenCancellationToken
Returns
Type Parameters
TModelThe declared model type used for member discovery.
Exceptions
- ArgumentNullException
An API argument is null.
- TemplateValidationException
Template content or its declared model contract fails static validation.
- OperationCanceledException
The operation is cancelled.
- TemplateRenderingException
Model projection or template execution fails.