Optimized error prompts

This commit is contained in:
sunkaixuan 2024-09-16 20:32:06 +08:00
parent cdea7820d3
commit 308e931cee
2 changed files with 5 additions and 1 deletions

View File

@ -41,7 +41,7 @@ namespace OrmTest
/// Database connection string
/// 数据库连接字符串
/// </summary>
public readonly static string Connection = "server=.;uid=sa;pwd=sasa;database=SqlSugar5Demo";
public readonly static string Connection = "server=.;uid=sa;pwd=sasa;database=SqlSugar5Demo;Encrypt=True;TrustServerCertificate=True";
/// <summary>
/// Get a new SqlSugarClient instance with specific configurations

View File

@ -183,6 +183,10 @@ namespace SqlSugar
}
catch (Exception ex)
{
if (this.Context.CurrentConnectionConfig?.DbType==DbType.SqlServer&&ex.Message?.Contains("provider: SSL")==true)
{
Check.ExceptionEasy(true,ex.Message, "SSL出错因为升级了驱动,字符串增加Encrypt=True;TrustServerCertificate=True;即可。详细错误:" + ex.Message);
}
Check.Exception(true, ErrorMessage.ConnnectionOpen, ex.Message+$"DbType=\"{this.Context.CurrentConnectionConfig.DbType}\";ConfigId=\"{this.Context.CurrentConnectionConfig.ConfigId}\"");
}
}