Synchronization code

This commit is contained in:
sunkaixuan
2024-04-29 14:56:46 +08:00
parent 65c634f994
commit b8645685fa
3 changed files with 6 additions and 2 deletions

View File

@@ -237,6 +237,8 @@ namespace SqlSugar
Check.Exception(whereColumns == null || whereColumns.Count() == 0, "where columns count=0 or need primary key");
var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection;
this.context.CurrentConnectionConfig.IsAutoCloseConnection = false;
var old = this.context.Ado.IsDisableMasterSlaveSeparation;
this.context.Ado.IsDisableMasterSlaveSeparation = true;
DataTable dt = ToDdateTable(datas);
IFastBuilder buider = GetBuider();
buider.Context = context;
@@ -255,6 +257,7 @@ namespace SqlSugar
this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto;
buider.CloseDb();
End(datas, false, true);
this.context.Ado.IsDisableMasterSlaveSeparation = old;
return result;
}
catch (Exception)

View File

@@ -142,11 +142,11 @@ namespace SqlSugar
value = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
}
}
else if (value != null && column.UnderType?.FullName == "System.TimeOnly")
else if (value != DBNull.Value&&value != null && column.UnderType?.FullName == "System.TimeOnly")
{
value = UtilMethods.TimeOnlyToTimeSpan(value);
}
else if (value != null && column.UnderType?.FullName == "System.DateOnly")
else if (value != DBNull.Value && value != null && column.UnderType?.FullName == "System.DateOnly")
{
value = UtilMethods.DateOnlyToDateTime(value);
}

View File

@@ -279,6 +279,7 @@ namespace SqlSugar
}
public Navigate(NavigateType navigatType, string ifSingleMasterTableColumn_IfListChildTableColumn, string ifSingleChildTableColumn_IfListMasterTableColumn)
{
Check.ExceptionEasy(navigatType == NavigateType.ManyToMany, "Correct usage [Navigate(typeof(ABMapping), nameof(abmapping.aid), nameof(abmapp.bid))], incorrect usage: [Navigate(Navigate.ManyToMany, nameof(ABMapping.Aid), nameof(ABMapping.BId))]", "多对多第一个参数是Type不是NavigateType正确用法[Navigate(typeof(ABMapping), nameof(ABMapping.Aid), nameof(ABMapping.BId))],错误用法:[Navigate(Navigate.ManyToMany, nameof(ABMapping.Aid), nameof(ABMapping.BId))]");
this.Name = ifSingleMasterTableColumn_IfListChildTableColumn;
this.Name2 = ifSingleChildTableColumn_IfListMasterTableColumn;
this.NavigatType = navigatType;