Esempio n. 1
0
        override public void Initialize(string name, NameValueCollection config)
        {
            Debug.Trace("MailWebEventProvider", "Initializing: name=" + name);

            ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "from", name, ref _from);

            // Read "to", "cc" and "bcc"
            ProviderUtil.GetAndRemoveStringAttribute(config, "to", name, ref _to);
            ProviderUtil.GetAndRemoveStringAttribute(config, "cc", name, ref _cc);
            ProviderUtil.GetAndRemoveStringAttribute(config, "bcc", name, ref _bcc);

            if (String.IsNullOrEmpty(_to) &&
                String.IsNullOrEmpty(_cc) &&
                String.IsNullOrEmpty(_bcc))
            {
                throw new ConfigurationErrorsException(
                          SR.GetString(SR.MailWebEventProvider_no_recipient_error, this.GetType().ToString(),
                                       name));
            }

            ProviderUtil.GetAndRemoveStringAttribute(config, "subjectPrefix", name, ref _subjectPrefix);

            ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxMessagesPerNotification", name, ref _maxMessagesPerNotification);

            ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxEventsPerMessage", name, ref _maxEventsPerMessage);

            _smtpClient = CreateSmtpClientWithAssert();

            base.Initialize(name, config);
        }
 public override void Initialize(string name, NameValueCollection config)
 {
     ProviderUtil.GetAndRemoveBooleanAttribute(config, "buffer", name, ref this._buffer);
     if (this._buffer)
     {
         ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "bufferMode", name, ref this._bufferMode);
         this._webEventBuffer = new WebEventBuffer(this, this._bufferMode, new WebEventBufferFlushCallback(this.ProcessEventFlush));
     }
     else
     {
         ProviderUtil.GetAndRemoveStringAttribute(config, "bufferMode", name, ref this._bufferMode);
     }
     base.Initialize(name, config);
     ProviderUtil.CheckUnrecognizedAttributes(config, name);
 }
 public override void Initialize(string name, NameValueCollection config)
 {
     ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "from", name, ref this._from);
     ProviderUtil.GetAndRemoveStringAttribute(config, "to", name, ref this._to);
     ProviderUtil.GetAndRemoveStringAttribute(config, "cc", name, ref this._cc);
     ProviderUtil.GetAndRemoveStringAttribute(config, "bcc", name, ref this._bcc);
     if ((string.IsNullOrEmpty(this._to) && string.IsNullOrEmpty(this._cc)) && string.IsNullOrEmpty(this._bcc))
     {
         throw new ConfigurationErrorsException(System.Web.SR.GetString("MailWebEventProvider_no_recipient_error", new object[] { base.GetType().ToString(), name }));
     }
     ProviderUtil.GetAndRemoveStringAttribute(config, "subjectPrefix", name, ref this._subjectPrefix);
     ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxMessagesPerNotification", name, ref this._maxMessagesPerNotification);
     ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxEventsPerMessage", name, ref this._maxEventsPerMessage);
     this._smtpClient = CreateSmtpClientWithAssert();
     base.Initialize(name, config);
 }
        public override void Initialize(string name, NameValueCollection config)
        {
            // create buffer according to the buffer mode settings specified, like we do in sql/mail providers
            // wire up the delegate to the ProcessEventFlush method
            Debug.Trace("BufferedWebEventProvider", "Initializing: name=" + name);

            ProviderUtil.GetAndRemoveBooleanAttribute(config, "buffer", name, ref _buffer);

            if (_buffer)
            {
                ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "bufferMode", name, ref _bufferMode);
                _webEventBuffer = new WebEventBuffer(this, _bufferMode, new WebEventBufferFlushCallback(this.ProcessEventFlush));
            }
            else
            {
                ProviderUtil.GetAndRemoveStringAttribute(config, "bufferMode", name, ref _bufferMode);
            }

            base.Initialize(name, config);

            ProviderUtil.CheckUnrecognizedAttributes(config, name);
        }