Ejemplo n.º 1
0
        public static string RenderTemplate([NotNull] this string template, [NotNull] object model)
        {
            if (template == null)
            {
                throw new ArgumentNullException(nameof(template));
            }
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            using (var writer = new StringWriter())
            {
                GetCompiledTemplate(template, model.GetType())(writer, model);
                return(writer.ToString());
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the message body.
 /// </summary>
 /// <param name="data">The notification body.</param>
 /// <returns>The string message body.</returns>
 public string GetMessageBody(Dictionary <string, object> data)
 {
     return(SendAllProperties
         ? JsonSerializer.Serialize(data, JsonDefaults.Options)
         : GetCompiledTemplate()(data));
 }