mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-12-21 17:05:47 +08:00
## v0.3.11
- 增加 ISelect、IInsert、IUpdate、IDelete WithTransaction 方法,将事务对象暴露给外部; - 增加 IAdo ExecuteXxx 系列方法重载,支持事务对象的传入;
This commit is contained in:
@@ -19,6 +19,7 @@ namespace FreeSql.Internal.CommonProvider {
|
||||
protected TableInfo _table;
|
||||
protected Func<string, string> _tableRule;
|
||||
protected DbParameter[] _params;
|
||||
protected DbTransaction _transaction;
|
||||
|
||||
public InsertProvider(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression) {
|
||||
_orm = orm;
|
||||
@@ -28,6 +29,11 @@ namespace FreeSql.Internal.CommonProvider {
|
||||
if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure<T1>();
|
||||
}
|
||||
|
||||
public IInsert<T1> WithTransaction(DbTransaction transaction) {
|
||||
_transaction = transaction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IInsert<T1> AppendData(T1 source) {
|
||||
if (source != null) _source.Add(source);
|
||||
return this;
|
||||
@@ -37,8 +43,8 @@ namespace FreeSql.Internal.CommonProvider {
|
||||
return this;
|
||||
}
|
||||
|
||||
public int ExecuteAffrows() => _orm.Ado.ExecuteNonQuery(CommandType.Text, this.ToSql(), _params);
|
||||
public Task<int> ExecuteAffrowsAsync() => _orm.Ado.ExecuteNonQueryAsync(CommandType.Text, this.ToSql(), _params);
|
||||
public int ExecuteAffrows() => _orm.Ado.ExecuteNonQuery(_transaction, CommandType.Text, this.ToSql(), _params);
|
||||
public Task<int> ExecuteAffrowsAsync() => _orm.Ado.ExecuteNonQueryAsync(_transaction, CommandType.Text, this.ToSql(), _params);
|
||||
public abstract long ExecuteIdentity();
|
||||
public abstract Task<long> ExecuteIdentityAsync();
|
||||
public abstract List<T1> ExecuteInserted();
|
||||
|
||||
Reference in New Issue
Block a user