|
|
@ -41,10 +41,12 @@ namespace SqlSugar |
|
|
|
foreach (var item in InsertBuilder.DbColumnInfoList) |
|
|
|
{ |
|
|
|
var isPk = pks.Any(y => y.Equals(item.DbColumnName, StringComparison.CurrentCultureIgnoreCase)) || item.IsPrimarykey; |
|
|
|
if (isPk && item.PropertyType == UtilConstants.GuidType&&item.Value.ObjToString()==Guid.Empty.ToString()) { |
|
|
|
if (isPk && item.PropertyType == UtilConstants.GuidType && item.Value.ObjToString() == Guid.Empty.ToString()) |
|
|
|
{ |
|
|
|
item.Value = Guid.NewGuid(); |
|
|
|
if (InsertObjs.First().GetType().GetProperties().Any(it => it.Name == item.PropertyName)) |
|
|
|
InsertObjs.First().GetType().GetProperties().First(it => it.Name == item.PropertyName).SetValue(InsertObjs.First(), item.Value, null); |
|
|
|
} |
|
|
|
InsertObjs.First().GetType().GetProperties().First(it => it.Name == item.PropertyName).SetValue(InsertObjs.First(),item.Value,null); |
|
|
|
} |
|
|
|
} |
|
|
|
InsertBuilder.IsReturnIdentity = false; |
|
|
|