/// <summary> /// Initializes a new instance of the <see cref="DnsDomainConfiguration"/> class with /// the specified values. /// </summary> /// <remarks> /// <note type="inherit"> /// Derived types may use this constructor to create a configuration with class derived from /// <see cref="RecordsList"/> or <see cref="SubdomainsList"/> should a server change or extension /// require additional information be passed in the body of the request. /// </note> /// </remarks> /// <param name="name">The fully-qualified domain name.</param> /// <param name="timeToLive">The time-to-live for the domain.</param> /// <param name="emailAddress">The email address associated with the domain.</param> /// <param name="comment">An optional comment associated with the domain.</param> /// <param name="records">A <see cref="RecordsList"/> object containing the initial DNS records to associate with the domain.</param> /// <param name="subdomains">A <see cref="SubdomainsList"/> object containing the initial subdomains to create with the domain.</param> /// <exception cref="ArgumentNullException"> /// If <paramref name="name"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="emailAddress"/> is <see langword="null"/>.</para> /// <para>-or-</para> /// <para>If <paramref name="records"/> is <see langword="null"/>.</para> /// <para>-or-</para> /// <para>If <paramref name="subdomains"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException">If <paramref name="name"/> is empty.</exception> /// <exception cref="ArgumentOutOfRangeException">If <paramref name="timeToLive"/> is negative or <see cref="TimeSpan.Zero"/>.</exception> protected DnsDomainConfiguration(string name, TimeSpan?timeToLive, string emailAddress, string comment, RecordsList records, SubdomainsList subdomains) { if (name == null) { throw new ArgumentNullException("name"); } if (emailAddress == null) { throw new ArgumentNullException("emailAddress"); } if (records == null) { throw new ArgumentNullException("records"); } if (subdomains == null) { throw new ArgumentNullException("subdomains"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException("name cannot be empty"); } if (string.IsNullOrEmpty(emailAddress)) { throw new ArgumentException("emailAddress cannot be empty"); } if (timeToLive <= TimeSpan.Zero) { throw new ArgumentOutOfRangeException("timeToLive cannot be negative or zero"); } _name = name; _emailAddress = emailAddress; _comment = comment; if (timeToLive.HasValue) { _timeToLive = (int)timeToLive.Value.TotalSeconds; } _recordsList = records; _subdomains = subdomains; }
/// <summary> /// Initializes a new instance of the <see cref="DnsDomainConfiguration"/> class with /// the specified values. /// </summary> /// <remarks> /// <note type="inherit"> /// Derived types may use this constructor to create a configuration with class derived from /// <see cref="RecordsList"/> or <see cref="SubdomainsList"/> should a server change or extension /// require additional information be passed in the body of the request. /// </note> /// </remarks> /// <param name="name">The fully-qualified domain name.</param> /// <param name="timeToLive">The time-to-live for the domain.</param> /// <param name="emailAddress">The email address associated with the domain.</param> /// <param name="comment">An optional comment associated with the domain.</param> /// <param name="records">A <see cref="RecordsList"/> object containing the initial DNS records to associate with the domain.</param> /// <param name="subdomains">A <see cref="SubdomainsList"/> object containing the initial subdomains to create with the domain.</param> /// <exception cref="ArgumentNullException"> /// If <paramref name="name"/> is <c>null</c>. /// <para>-or-</para> /// <para>If <paramref name="emailAddress"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para>If <paramref name="records"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para>If <paramref name="subdomains"/> is <c>null</c>.</para> /// </exception> /// <exception cref="ArgumentException">If <paramref name="name"/> is empty.</exception> /// <exception cref="ArgumentOutOfRangeException">If <paramref name="timeToLive"/> is negative or <see cref="TimeSpan.Zero"/>.</exception> protected DnsDomainConfiguration(string name, TimeSpan? timeToLive, string emailAddress, string comment, RecordsList records, SubdomainsList subdomains) { if (name == null) throw new ArgumentNullException("name"); if (emailAddress == null) throw new ArgumentNullException("emailAddress"); if (records == null) throw new ArgumentNullException("records"); if (subdomains == null) throw new ArgumentNullException("subdomains"); if (string.IsNullOrEmpty(name)) throw new ArgumentException("name cannot be empty"); if (string.IsNullOrEmpty(emailAddress)) throw new ArgumentException("emailAddress cannot be empty"); if (timeToLive <= TimeSpan.Zero) throw new ArgumentOutOfRangeException("timeToLive cannot be negative or zero"); _name = name; _emailAddress = emailAddress; _comment = comment; if (timeToLive.HasValue) _timeToLive = (int)timeToLive.Value.TotalSeconds; _recordsList = records; _subdomains = subdomains; }