Update .net core project

This commit is contained in:
sunkaixuan 2022-06-12 16:21:42 +08:00
parent 5a7b5ca8b9
commit f4422d3a81
4 changed files with 26 additions and 3 deletions

View File

@ -34,7 +34,7 @@ namespace SqlSugar
{ {
get get
{ {
return ErrorMessage.GetThrowMessage("Connection open error . {0}", " 连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,实在找不到原因请先Google错误信息:{0}."); return ErrorMessage.GetThrowMessage("Connection open error . {0}", " 连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,错误信息:{0}.");
} }
} }
public static string ExpressionCheck public static string ExpressionCheck

View File

@ -117,7 +117,15 @@ namespace SqlSugar
{ {
return GetOneToManySql(); return GetOneToManySql();
} }
else else if (Navigat.NavigatType == NavigateType.Dynamic)
{
Check.ExceptionEasy(
true,
" NavigateType.Dynamic no support expression . " + this.ProPertyEntity.Type.Name,
" NavigateType.Dynamic 自定义导航对象不支持在Where(x=>x.自定义.Id==1)等方法中使用" + this.ProPertyEntity.Type.Name);
return null;
}
else
{ {
return GetManyToManySql(); return GetManyToManySql();
} }

View File

@ -70,6 +70,13 @@ namespace SqlSugar
{ {
Check.ExceptionEasy(true, " expression error ", "导航查询出错,比如.Count要改成 .Count()"); Check.ExceptionEasy(true, " expression error ", "导航查询出错,比如.Count要改成 .Count()");
} }
else if (Navigat.NavigatType == NavigateType.Dynamic)
{
Check.ExceptionEasy(
true,
" NavigateType.Dynamic no support expression . "+ this.ProPertyEntity.Type.Name,
" NavigateType.Dynamic 自定义导航对象不支持在Where(x=>x.自定义.Id==1)等方法中使用"+ this.ProPertyEntity.Type.Name);
}
var pk = this.ProPertyEntity.Columns.First(it => it.IsPrimarykey == true).DbColumnName; var pk = this.ProPertyEntity.Columns.First(it => it.IsPrimarykey == true).DbColumnName;
var name = this.EntityInfo.Columns.First(it => it.PropertyName == Navigat.Name).DbColumnName; var name = this.EntityInfo.Columns.First(it => it.PropertyName == Navigat.Name).DbColumnName;
var selectName = this.ProPertyEntity.Columns.First(it => it.PropertyName ==MemberName).DbColumnName; var selectName = this.ProPertyEntity.Columns.First(it => it.PropertyName ==MemberName).DbColumnName;

View File

@ -20,6 +20,7 @@ namespace SqlSugar
try try
{ {
var mySqlConnectionString = base.Context.CurrentConnectionConfig.ConnectionString; var mySqlConnectionString = base.Context.CurrentConnectionConfig.ConnectionString;
Check.ExceptionEasy(String.IsNullOrEmpty(mySqlConnectionString), "ConnectionString is not null", "连接字符串ConnectionString不能为Null");
if (!mySqlConnectionString.ToLower().Contains("charset")&& !mySqlConnectionString.ToLower().Contains("character")) if (!mySqlConnectionString.ToLower().Contains("charset")&& !mySqlConnectionString.ToLower().Contains("character"))
{ {
mySqlConnectionString = mySqlConnectionString.Trim().TrimEnd(';') + ";charset=utf8;"; mySqlConnectionString = mySqlConnectionString.Trim().TrimEnd(';') + ";charset=utf8;";
@ -28,7 +29,14 @@ namespace SqlSugar
} }
catch (Exception ex) catch (Exception ex)
{ {
Check.Exception(true, ErrorMessage.ConnnectionOpen, ex.Message); if (ex is SqlSugarException)
{
throw ex;
}
else
{
Check.Exception(true, ErrorMessage.ConnnectionOpen, ex.Message);
}
} }
} }
return base._DbConnection; return base._DbConnection;