mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-24 05:42:01 +08:00
-
This commit is contained in:
@@ -186,8 +186,8 @@ namespace SqlSugar
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private void PreToSql()
|
||||
#region Protected Methods
|
||||
protected void PreToSql()
|
||||
{
|
||||
#region Identities
|
||||
if (!IsOffIdentity)
|
||||
@@ -255,7 +255,7 @@ namespace SqlSugar
|
||||
++i;
|
||||
}
|
||||
}
|
||||
private string GetDbColumnName(string entityName)
|
||||
protected string GetDbColumnName(string entityName)
|
||||
{
|
||||
if (!IsMappingColumns)
|
||||
{
|
||||
@@ -276,7 +276,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> GetPrimaryKeys()
|
||||
protected virtual List<string> GetPrimaryKeys()
|
||||
{
|
||||
if (this.Context.IsSystemTablesConfig)
|
||||
{
|
||||
@@ -298,14 +298,14 @@ namespace SqlSugar
|
||||
return this.EntityInfo.Columns.Where(it => it.IsIdentity).Select(it => it.DbColumnName).ToList();
|
||||
}
|
||||
}
|
||||
private void RestoreMapping()
|
||||
protected void RestoreMapping()
|
||||
{
|
||||
if (IsAs)
|
||||
{
|
||||
this.Context.MappingTables = OldMappingTableList;
|
||||
}
|
||||
}
|
||||
private IInsertable<T> CopyInsertable()
|
||||
protected IInsertable<T> CopyInsertable()
|
||||
{
|
||||
var asyncContext = this.Context.Utilities.CopyContext(this.Context,true);
|
||||
asyncContext.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||
|
||||
@@ -7,6 +7,39 @@ namespace SqlSugar
|
||||
{
|
||||
public class OracleInsertable<T> : InsertableProvider<T> where T : class, new()
|
||||
{
|
||||
public override int ExecuteCommand()
|
||||
{
|
||||
InsertBuilder.IsReturnIdentity = false;
|
||||
PreToSql();
|
||||
string sql = InsertBuilder.ToSqlString();
|
||||
RestoreMapping();
|
||||
return Ado.ExecuteCommand(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
}
|
||||
|
||||
public override KeyValuePair<string, List<SugarParameter>> ToSql()
|
||||
{
|
||||
InsertBuilder.IsReturnIdentity = true;
|
||||
PreToSql();
|
||||
string sql = InsertBuilder.ToSqlString();
|
||||
RestoreMapping();
|
||||
return new KeyValuePair<string, List<SugarParameter>>(sql, InsertBuilder.Parameters);
|
||||
}
|
||||
public override int ExecuteReturnIdentity()
|
||||
{
|
||||
InsertBuilder.IsReturnIdentity = true;
|
||||
PreToSql();
|
||||
string sql = InsertBuilder.ToSqlString();
|
||||
RestoreMapping();
|
||||
return Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
}
|
||||
public override long ExecuteReturnBigIdentity()
|
||||
{
|
||||
InsertBuilder.IsReturnIdentity = true;
|
||||
PreToSql();
|
||||
string sql = InsertBuilder.ToSqlString();
|
||||
RestoreMapping();
|
||||
return Convert.ToInt64(Ado.GetScalar(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()));
|
||||
}
|
||||
protected override List<string> GetIdentityKeys()
|
||||
{
|
||||
return this.EntityInfo.Columns.Where(it => it.OracleSequenceName.IsValuable()).Select(it => it.DbColumnName).ToList();
|
||||
|
||||
Reference in New Issue
Block a user