public virtual string Run(out HtmlEmailMetadata metadata)
 {
     using (var writer = new StringWriter())
     {
         Run(writer, out metadata);
         return(writer.ToString());
     }
 }
Exemple #2
0
        public virtual string Run(out HtmlEmailMetadata metadata, params object[] parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var writer = new StringWriter();
            Run(writer, out metadata, parameters);
            return(writer.ToString());
        }
Exemple #3
0
        public virtual void Run(TextWriter writer, out HtmlEmailMetadata metadata)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            var p = CreateMethodParameters(writer, (object[])null);

            InvokeRunMethod(p);
            metadata = GetMetadata(p);
        }
        private static HtmlEmailMetadata GetMetadata(object[] parameters)
        {
            HtmlEmailOutput htmlEmailOutput = parameters.OfType <HtmlEmailOutput>().FirstOrDefault();

            if (htmlEmailOutput != null)
            {
                var metadata = new HtmlEmailMetadata();
                metadata.Title = htmlEmailOutput.GetSection(HtmlEmailOutput.TitleSectionName);
                metadata.ContentIdentifiers = htmlEmailOutput.ContentIdentifiers;
                return(metadata);
            }

            return(null);
        }
Exemple #5
0
        public virtual void Run(TextWriter writer, out HtmlEmailMetadata metadata, IReadOnlyDictionary <string, object> parameters)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            var p = CreateMethodParameters(writer, parameters);

            InvokeRunMethod(p);
            metadata = GetMetadata(p);
        }