示例#1
0
 /// <summary>
 /// CA Certificate File, CACertificateFile, SslCa, Ssl-Ca
 /// </summary>
 public XConnectionBuilder SetCACertificateFile(string cACertificateFile)
 {
     if (cACertificateFile.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._091, "CACertificateFile 不能为空!");
     }
     DbPairs.AddOrReplace("CACertificateFile", cACertificateFile.Trim());
     return(this);
 }
示例#2
0
 /// <summary>
 /// 同SetServer()方法 -- 数据库位置:Host, Server, Data Source, DataSource, Address, Addr, Network Address 默认:127.0.0.1 集群','隔开:host01,host02,host03...
 /// </summary>
 public XConnectionBuilder SetHost(string host)
 {
     if (host.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._144, "数据库位置 Host 不能为空!");
     }
     DbPairs.AddOrReplace("Host", host.Trim());
     return(this);
 }
示例#3
0
 /// <summary>
 /// 是否用受影响的行数替代查找到的行数来返回数据:Use Affected Rows, UseAffectedRows 默认:false
 /// </summary>
 public XConnectionBuilder SetUseAffectedRows(bool?useAffectedRows)
 {
     if (useAffectedRows.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._123, "是否用受影响的行数替代查找到的行数来返回数据 UseAffectedRows 不能为空!");
     }
     DbPairs.AddOrReplace("UseAffectedRows", useAffectedRows.ToString().ToLower());
     return(this);
 }
示例#4
0
 /// <summary>
 /// 保持TCP连接的秒数:Keep Alive, Keepalive 默认:0-默认操作系统设置
 /// </summary>
 public XConnectionBuilder SetKeepalive(int?keepalive)
 {
     if (keepalive.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._125, "保持TCP连接的秒数 Keepalive 不能为空!");
     }
     DbPairs.AddOrReplace("Keepalive", keepalive.ToString());
     return(this);
 }
示例#5
0
 /// <summary>
 /// 是否保持敏感信息:Persist Security Info, PersistSecurityInfo 默认:false
 /// </summary>
 public XConnectionBuilder SetPersistSecurityInfo(bool?persistSecurityInfo)
 {
     if (persistSecurityInfo.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._105, "是否保持敏感信息 PersistSecurityInfo 不能为空!");
     }
     DbPairs.AddOrReplace("PersistSecurityInfo", persistSecurityInfo.ToString().ToLower());
     return(this);
 }
示例#6
0
 /// <summary>
 /// DateTimeKind  默认:Unspecified
 /// </summary>
 public XConnectionBuilder SetDateTimeKind(string dateTimeKind)
 {
     if (dateTimeKind.IsBlank())
     {
         throw XConfig.EC.Exception(XConfig.EC._139, "DateTimeKind 不能为空!");
     }
     DbPairs.AddOrReplace("DateTimeKind", dateTimeKind.Trim());
     return(this);
 }
示例#7
0
 /// <summary>
 /// IgnoreCommandTransaction, Ignore Command Transaction 默认:false
 /// </summary>
 public XConnectionBuilder SetIgnoreCommandTransaction(bool?ignoreCommandTransaction)
 {
     if (ignoreCommandTransaction.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._140, "IgnoreCommandTransaction, Ignore Command Transaction 不能为空!");
     }
     DbPairs.AddOrReplace("IgnoreCommandTransaction", ignoreCommandTransaction.ToString().ToLower());
     return(this);
 }
示例#8
0
 /// <summary>
 /// 线程池中允许最多连接数数:Maximum Pool Size, Max Pool Size, MaximumPoolsize, maxpoolsize 默认:50
 /// </summary>
 public XConnectionBuilder SetMaximumPoolSize(int?maximumPoolSize)
 {
     if (maximumPoolSize.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._129, "线程池中允许最多连接数数 MaximumPoolsize 不能为空!");
     }
     DbPairs.AddOrReplace("MaximumPoolsize", maximumPoolSize.ToString());
     return(this);
 }
示例#9
0
 /// <summary>
 /// 线程池中保持最少连接数:Minimum Pool Size, Min Pool Size, MinimumPoolSize, minpoolsize 默认:10
 /// </summary>
 public XConnectionBuilder SetMinimumPoolSize(int?minimumPoolSize)
 {
     if (minimumPoolSize.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._128, "线程池中保持最少连接数 MinimumPoolSize 不能为空!");
     }
     DbPairs.AddOrReplace("MinimumPoolSize", minimumPoolSize.ToString());
     return(this);
 }
示例#10
0
 /// <summary>
 /// 连接被销毁前在连接池中保持的最少时间(秒):Connection Lifetime, ConnectionLifeTime 默认:0
 /// </summary>
 public XConnectionBuilder SetConnectionLifeTime(int?connectionLifeTime)
 {
     if (connectionLifeTime.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._126, "连接被销毁前在连接池中保持的最少时间(秒) ConnectionLifeTime 不能为空!");
     }
     DbPairs.AddOrReplace("ConnectionLifeTime", connectionLifeTime.ToString());
     return(this);
 }
示例#11
0
 /// <summary>
 /// 连接过期后是否自动复位:Connection Reset, ConnectionReset 默认:true
 /// </summary>
 public XConnectionBuilder SetConnectionReset(bool?connectionReset)
 {
     if (connectionReset.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._130, "连接过期后是否自动复位 ConnectionReset 不能为空!");
     }
     DbPairs.AddOrReplace("ConnectionReset", connectionReset.ToString().ToLower());
     return(this);
 }
示例#12
0
 /// <summary>
 /// 是否使用线程池:Pooling 默认:true
 /// </summary>
 public XConnectionBuilder SetPooling(bool?pooling)
 {
     if (pooling.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._127, "是否使用线程池 Pooling 不能为空!");
     }
     DbPairs.AddOrReplace("Pooling", pooling.ToString().ToLower());
     return(this);
 }
示例#13
0
 /// <summary>
 /// 证书指纹:Certificate Thumbprint, CertificateThumbprint 默认:""
 /// </summary>
 public XConnectionBuilder SetCertificateThumbprint(string certificateThumbprint)
 {
     if (certificateThumbprint.IsBlank())
     {
         throw XConfig.EC.Exception(XConfig.EC._109, "证书指纹 CertificateThumbprint 不能为空!");
     }
     DbPairs.AddOrReplace("CertificateThumbprint", certificateThumbprint.Trim());
     return(this);
 }
示例#14
0
 /// <summary>
 /// 证书的存储位置:Certificate Store Location, CertificateStoreLocation 默认:None
 /// </summary>
 public XConnectionBuilder SetCertificateStoreLocation(string certificateStoreLocation)
 {
     if (certificateStoreLocation.IsBlank())
     {
         throw XConfig.EC.Exception(XConfig.EC._108, "证书的存储位置 CertificateStoreLocation 不能为空!");
     }
     DbPairs.AddOrReplace("CertificateStoreLocation", certificateStoreLocation.Trim());
     return(this);
 }
示例#15
0
 /// <summary>
 /// 连接超时等待时间:Connect Timeout, Connection Timeout, ConnectionTimeout 默认:15s
 /// </summary>
 public XConnectionBuilder SetConnectionTimeout(int?connectionTimeout)
 {
     if (connectionTimeout.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._101, "连接超时等待时间 ConnectionTimeout 不能为空!");
     }
     DbPairs.AddOrReplace("ConnectionTimeout", connectionTimeout.ToString());
     return(this);
 }
示例#16
0
 /// <summary>
 /// AllowLoadLocalInfile, Allow Load Local Infile  默认:false
 /// </summary>
 public XConnectionBuilder SetAllowLoadLocalInfile(bool?allowLoadLocalInfile)
 {
     if (allowLoadLocalInfile.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._136, "AllowLoadLocalInfile, Allow Load Local Infile 不能为空!");
     }
     DbPairs.AddOrReplace("AllowLoadLocalInfile", allowLoadLocalInfile.ToString().ToLower());
     return(this);
 }
示例#17
0
 /// <summary>
 /// 零是否转化为最小日期:Convert Zero Datetime, ConvertZeroDateTime 默认:false
 /// </summary>
 public XConnectionBuilder SetConvertZeroDateTime(bool?convertZeroDateTime)
 {
     if (convertZeroDateTime.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._111, "零是否转化为最小日期 ConvertZeroDateTime 不能为空!");
     }
     DbPairs.AddOrReplace("ConvertZeroDateTime", convertZeroDateTime.ToString().ToLower());
     return(this);
 }
示例#18
0
 /// <summary>
 /// AllowPublicKeyRetrieval, Allow Public Key Retrieval 默认:true
 /// </summary>
 public XConnectionBuilder SetAllowPublicKeyRetrieval(bool?allowPublicKeyRetrieval)
 {
     if (allowPublicKeyRetrieval.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._137, "AllowPublicKeyRetrieval, Allow Public Key Retrieval 不能为空!");
     }
     DbPairs.AddOrReplace("AllowPublicKeyRetrieval", allowPublicKeyRetrieval.ToString().ToLower());
     return(this);
 }
示例#19
0
 /// <summary>
 /// 命令执行超时时间:Default Command Timeout, Command Timeout, DefaultCommandTimeout 默认:30s
 /// </summary>
 public XConnectionBuilder SetDefaultCommandTimeout(int?defaultCommandTimeout)
 {
     if (defaultCommandTimeout.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._102, "命令执行超时时间 DefaultCommandTimeout 不能为空!");
     }
     DbPairs.AddOrReplace("DefaultCommandTimeout", defaultCommandTimeout.ToString());
     return(this);
 }
示例#20
0
 /// <summary>
 /// 是否允许SQL中出现用户变量:AllowUserVariables, Allow User Variables 默认:false
 /// </summary>
 public XConnectionBuilder SetAllowUserVariables(bool?allowUserVariables)
 {
     if (allowUserVariables.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._120, "是否允许SQL中出现用户变量 AllowUserVariables 不能为空!");
     }
     DbPairs.AddOrReplace("AllowUserVariables", allowUserVariables.ToString().ToLower());
     return(this);
 }
示例#21
0
 /// <summary>
 /// 会话是否允许交互:Interactive, Interactive Session, InteractiveSession 默认:false
 /// </summary>
 public XConnectionBuilder SetInteractive(bool?interactive)
 {
     if (interactive.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._121, "会话是否允许交互 Interactive 不能为空!");
     }
     DbPairs.AddOrReplace("Interactive", interactive.ToString().ToLower());
     return(this);
 }
示例#22
0
 /// <summary>
 /// 日期时间能否为零:AllowZeroDateTime, Allow Zero DateTime 默认:false
 /// </summary>
 public XConnectionBuilder SetAllowZeroDateTime(bool?allowZeroDateTime)
 {
     if (allowZeroDateTime.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._110, "日期时间能否为零 AllowZeroDateTime 不能为空!");
     }
     DbPairs.AddOrReplace("AllowZeroDateTime", allowZeroDateTime.ToString().ToLower());
     return(this);
 }
示例#23
0
 /// <summary>
 /// No Backslash Escapes, NoBackslashEscapes 默认:false
 /// </summary>
 public XConnectionBuilder SetNoBackslashEscapes(bool?noBackslashEscapes)
 {
     if (noBackslashEscapes.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._141, "No Backslash Escapes, NoBackslashEscapes 不能为空!");
     }
     DbPairs.AddOrReplace("NoBackslashEscapes", noBackslashEscapes.ToString().ToLower());
     return(this);
 }
示例#24
0
 /// <summary>
 /// ApplicationName, Application Name 默认:""
 /// </summary>
 public XConnectionBuilder SetApplicationName(string applicationName)
 {
     if (applicationName.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._138, "ApplicationName, Application Name 不能为空!");
     }
     DbPairs.AddOrReplace("ApplicationName", applicationName.Trim());
     return(this);
 }
示例#25
0
 /// <summary>
 /// ServerRSAPublicKeyFile, Server RSA Public Key File
 /// </summary>
 public XConnectionBuilder SetServerRSAPublicKeyFile(string serverRSAPublicKeyFile)
 {
     if (serverRSAPublicKeyFile.IsBlank())
     {
         throw XConfig.EC.Exception(XConfig.EC._142, "ServerRSAPublicKeyFile, Server RSA Public Key File 不能为空!");
     }
     DbPairs.AddOrReplace("ServerRSAPublicKeyFile", serverRSAPublicKeyFile.Trim());
     return(this);
 }
示例#26
0
 /// <summary>
 /// 连接MySQL所使用的字符集:CharSet, Character Set, CharacterSet 默认:"utf8mb4"
 /// </summary>
 public XConnectionBuilder SetCharset(string charset)
 {
     if (charset.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._131, "连接MySQL所使用的字符集 CharSet 不能为空!");
     }
     DbPairs.AddOrReplace("CharSet", charset.Trim());
     return(this);
 }
示例#27
0
 /// <summary>
 /// 是否将TINYINT(1)列视为布尔型:Treat Tiny As Boolean, TreatTinyAsBoolean 默认:true
 /// </summary>
 public XConnectionBuilder SetTreatTinyAsBoolean(bool?treatTinyAsBoolean)
 {
     if (treatTinyAsBoolean.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._119, "是否将TINYINT(1)列视为布尔型 TreatTinyAsBoolean 不能为空!");
     }
     DbPairs.AddOrReplace("TreatTinyAsBoolean", treatTinyAsBoolean.ToString().ToLower());
     return(this);
 }
示例#28
0
 /// <summary>
 /// 是否压缩:Compress, Use Compression, UseCompression 默认:false
 /// </summary>
 public XConnectionBuilder SetCompress(bool?compress)
 {
     if (compress.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._096, "是否压缩 Compress 不能为空!");
     }
     DbPairs.AddOrReplace("Compress", compress.ToString().ToLower());
     return(this);
 }
示例#29
0
 /// <summary>
 /// 端口:Port 默认:3306
 /// </summary>
 public XConnectionBuilder SetPort(int?port)
 {
     if (port.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._055, "端口 Port 不能为空!");
     }
     DbPairs.AddOrReplace("Port", port.ToString());
     return(this);
 }
示例#30
0
 /// <summary>
 /// 证书的密码:Certificate Password, CertificatePassword 默认:""
 /// </summary>
 public XConnectionBuilder SetCertificatePassword(string certificatePassword)
 {
     if (certificatePassword.IsNullStr())
     {
         throw XConfig.EC.Exception(XConfig.EC._107, "证书的密码 CertificatePassword 不能为空!");
     }
     DbPairs.AddOrReplace("CertificatePassword", certificatePassword.Trim());
     return(this);
 }