public override async Task <long> ExecuteReturnBigIdentityAsync() { InsertBuilder.IsReturnIdentity = true; PreToSql(); 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); }
public virtual async Task <long> ExecuteReturnBigIdentityAsync() { if (this.InsertObjs.Count() == 1 && this.InsertObjs.First() == null) { return(0); } string sql = _ExecuteReturnBigIdentity(); var result = Convert.ToInt64(await Ado.GetScalarAsync(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray())); After(sql, result); return(result); }
public override async Task <int> ExecuteReturnIdentityAsync() { InsertBuilder.IsReturnIdentity = true; PreToSql(); string sql = InsertBuilder.ToSqlString().Replace("$PrimaryKey", GetIdentityKeys().FirstOrDefault()); RestoreMapping(); var obj = await Ado.GetScalarAsync(sql, InsertBuilder.Parameters == null?null : InsertBuilder.Parameters.ToArray()); var result = obj.ObjToInt(); return(result); }