/*
 * 由SharpDevelop创建。
 * 用户： Administrator
 * 日期: 2019-03-21
 * 时间: 10:10
 * 
 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
 */
using System;
using System.Net;

namespace MrWu.DB {
    /// <summary>
    /// sql 配置
    /// </summary>
    public class SqlConfig {
        /// <summary>
        /// 配置名称
        /// </summary>
        public string name {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        public string host {
            get;
            set;
        }

        /// <summary>
        /// 端口
        /// </summary>
        public int port {
            get;
            set;
        }

        /// <summary>
        /// 用户名
        /// </summary>
        public string username {
            get;
            set;
        }

        /// <summary>
        /// 密码
        /// </summary>
        public string pwd {
            get;
            set;
        }

        /// <summary>
        /// 版本
        /// </summary>
        public string verison {
            get;
            set;
        }

        /// <summary>
        /// 是否允许使用会话变量
        /// </summary>
        public bool AllowUserVariables {
            get;
            set;
        }

        private int errorTryAgainCount_ = 5;

        /// <summary>
        /// 出错重试次数 0表示不重试
        /// </summary>
        public int errorTryAgainCount {
            get {
                return errorTryAgainCount_;
            }
            set {
                errorTryAgainCount_ = value;
            }
        }

        /// <summary>
        /// 出错重试时间增量 单位毫秒 0表示以固定时间间隔重试
        /// </summary>
        public int errorAgainTimeInc {
            get;
            set;
        }

        /// <summary>
        /// 不启用SSL模式
        /// </summary>
        public string sslMode = "None";

        private int _errorAginTime = 100;

        /// <summary>
        /// 执行出错,第一次多少毫秒后进行重试
        /// </summary>
        public int errorAgainTime {
            get {
                return _errorAginTime;
            }
            set {
                _errorAginTime = value;
            }
        }

        private int _cacheCount = 10;

        /// <summary>
        /// 缓存链接数量
        /// </summary>
        public int cacheCount {
            get {
                return _cacheCount;
            }
            set {
                _cacheCount = value;
            }
        }

        /// <summary>
        /// 限制链接数量
        /// </summary>
        private int _surviveCountSize = 0;

        /// <summary>
        /// 最大存活链接数
        /// </summary>
        public int surviveCountSize {
            get {
                return _surviveCountSize;
            }
            set {
                _surviveCountSize = value;
            }
        }

    }
}
