|
|
@ -38,7 +38,7 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
InsertBuilder.IsReturnIdentity = true; |
|
|
|
PreToSql(); |
|
|
|
string sql = InsertBuilder.ToSqlString().Replace("$PrimaryKey", GetIdentityKeys().FirstOrDefault()); |
|
|
|
string sql = InsertBuilder.ToSqlString().Replace("$PrimaryKey", this.SqlBuilder.GetTranslationColumnName(GetIdentityKeys().FirstOrDefault())); |
|
|
|
RestoreMapping(); |
|
|
|
var result = Convert.ToInt64(Ado.GetScalar(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()) ?? "0"); |
|
|
|
return result; |
|
|
@ -47,7 +47,7 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
InsertBuilder.IsReturnIdentity = true; |
|
|
|
PreToSql(); |
|
|
|
string sql = InsertBuilder.ToSqlString().Replace("$PrimaryKey", GetIdentityKeys().FirstOrDefault()); |
|
|
|
string sql = InsertBuilder.ToSqlString().Replace("$PrimaryKey", this.SqlBuilder.GetTranslationColumnName(GetIdentityKeys().FirstOrDefault())); |
|
|
|
RestoreMapping(); |
|
|
|
var result = Convert.ToInt64(await Ado.GetScalarAsync(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()) ?? "0"); |
|
|
|
return result; |
|
|
|