/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (MinPoolSize != null)
         {
             hashCode = hashCode * 59 + MinPoolSize.GetHashCode();
         }
         if (MaxPoolSize != null)
         {
             hashCode = hashCode * 59 + MaxPoolSize.GetHashCode();
         }
         if (QueueSize != null)
         {
             hashCode = hashCode * 59 + QueueSize.GetHashCode();
         }
         if (MaxThreadAge != null)
         {
             hashCode = hashCode * 59 + MaxThreadAge.GetHashCode();
         }
         if (KeepAliveTime != null)
         {
             hashCode = hashCode * 59 + KeepAliveTime.GetHashCode();
         }
         if (BlockPolicy != null)
         {
             hashCode = hashCode * 59 + BlockPolicy.GetHashCode();
         }
         if (ShutdownGraceful != null)
         {
             hashCode = hashCode * 59 + ShutdownGraceful.GetHashCode();
         }
         if (Daemon != null)
         {
             hashCode = hashCode * 59 + Daemon.GetHashCode();
         }
         if (ShutdownWaitTime != null)
         {
             hashCode = hashCode * 59 + ShutdownWaitTime.GetHashCode();
         }
         if (Priority != null)
         {
             hashCode = hashCode * 59 + Priority.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #2
0
        /// <summary>
        /// Constructs a connection string from the sql settings.
        /// </summary>
        /// <returns>Connection string.</returns>
        public String ToConnectionString()
        {
            StringBuilder connectionString = new StringBuilder();

            connectionString.Append(m_ConnectionString);

            // Strip the last semicolon.
            if (m_ConnectionString.EndsWith(";", StringComparison.OrdinalIgnoreCase))
            {
                connectionString.Remove(m_ConnectionString.Length - 1, 1);
            }

            if (!String.IsNullOrEmpty(InitialCatalog))
            {
                connectionString.Append(";Initial Catalog=");
                connectionString.Append(InitialCatalog);
            }

            if (MinPoolSize != -1)
            {
                connectionString.Append(";Min Pool Size=");
                connectionString.Append(MinPoolSize.ToString(CultureInfo.InvariantCulture));
            }

            if (MaxPoolSize != -1)
            {
                connectionString.Append(";Max Pool Size=");
                connectionString.Append(MaxPoolSize.ToString(CultureInfo.InvariantCulture));
            }

            if (ConnectionTimeout != -1)
            {
                connectionString.Append(";Connection Timeout=");
                connectionString.Append(ConnectionTimeout.ToString(CultureInfo.InvariantCulture));
            }

            return(connectionString.ToString());
        }
        /// <summary>
        /// Returns true if OrgApacheSlingCommonsThreadsImplDefaultThreadPoolFactoryProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingCommonsThreadsImplDefaultThreadPoolFactoryProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingCommonsThreadsImplDefaultThreadPoolFactoryProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     MinPoolSize == other.MinPoolSize ||
                     MinPoolSize != null &&
                     MinPoolSize.Equals(other.MinPoolSize)
                 ) &&
                 (
                     MaxPoolSize == other.MaxPoolSize ||
                     MaxPoolSize != null &&
                     MaxPoolSize.Equals(other.MaxPoolSize)
                 ) &&
                 (
                     QueueSize == other.QueueSize ||
                     QueueSize != null &&
                     QueueSize.Equals(other.QueueSize)
                 ) &&
                 (
                     MaxThreadAge == other.MaxThreadAge ||
                     MaxThreadAge != null &&
                     MaxThreadAge.Equals(other.MaxThreadAge)
                 ) &&
                 (
                     KeepAliveTime == other.KeepAliveTime ||
                     KeepAliveTime != null &&
                     KeepAliveTime.Equals(other.KeepAliveTime)
                 ) &&
                 (
                     BlockPolicy == other.BlockPolicy ||
                     BlockPolicy != null &&
                     BlockPolicy.Equals(other.BlockPolicy)
                 ) &&
                 (
                     ShutdownGraceful == other.ShutdownGraceful ||
                     ShutdownGraceful != null &&
                     ShutdownGraceful.Equals(other.ShutdownGraceful)
                 ) &&
                 (
                     Daemon == other.Daemon ||
                     Daemon != null &&
                     Daemon.Equals(other.Daemon)
                 ) &&
                 (
                     ShutdownWaitTime == other.ShutdownWaitTime ||
                     ShutdownWaitTime != null &&
                     ShutdownWaitTime.Equals(other.ShutdownWaitTime)
                 ) &&
                 (
                     Priority == other.Priority ||
                     Priority != null &&
                     Priority.Equals(other.Priority)
                 ));
        }