public virtual string Run(out HtmlEmailMetadata metadata)
 {
     using (var writer = new StringWriter())
     {
         Run(writer, out metadata);
         return(writer.ToString());
     }
 }
Beispiel #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());
        }
Beispiel #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);
        }
Beispiel #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);
        }