예제 #1
0
        /// <summary>
        /// Create.
        /// </summary>
        /// <param name="subject">The subject of the notification.</param>
        /// <param name="templateKey">The key of the template.</param>
        /// <param name="source">The source specifying the sender or system generating the notification.</param>
        /// <param name="destination">The destination of the notification.</param>
        /// <param name="time">The generation date of the notification, in UTC.</param>
        /// <param name="dynamicProperties">The dynamic properties.</param>
        /// <param name="topic">The topic which the notification serves.</param>
        public ChannelMessage(
            string subject,
            string templateKey,
            IChannelIdentity source,
            IChannelDestination destination,
            DateTime time,
            IReadOnlyDictionary <string, object> dynamicProperties,
            T topic = default(T))
        {
            if (subject == null)
            {
                throw new ArgumentNullException(nameof(subject));
            }
            if (templateKey == null)
            {
                throw new ArgumentNullException(nameof(templateKey));
            }
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }
            if (time.Kind != DateTimeKind.Utc)
            {
                throw new ArgumentException("Time is not in UTC.", nameof(time));
            }

            this.Guid = Guid.NewGuid();

            this.Subject           = subject;
            this.TemplateKey       = templateKey;
            this.Source            = source;
            this.Destination       = destination;
            this.Topic             = topic;
            this.Time              = time;
            this.Time              = time;
            this.DynamicProperties = dynamicProperties;
        }
예제 #2
0
 /// <summary>
 /// If true, send a single e-mail message with multiple recepients, else send one e-mail message per destination.
 /// </summary>
 protected abstract bool UseSingleMessageForMultipleRecepients(IChannelDestination destination, T topic);
예제 #3
0
 /// <summary>
 /// Override to extract e-mail recepients from a destination object and a topic.
 /// </summary>
 protected abstract Task <IEnumerable <IChannelIdentity> > GetDestinationIdentitiesAsync(IChannelDestination destination, T topic);