mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update insert bug
This commit is contained in:
@@ -8,7 +8,7 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=haosql;database=SqlSugar4XTest";
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SqlSugar4XTest";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=haosql;database=sqlsugar4xtest";
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user