Look for some help :)
I have multiple stored procedures in MS SQL Server which in themselves are defined as transactions.
In my repository I want to call multiple ExecuteAsync() on stored procedures but for them to be wrapped in a unit of work.
I have managed to implement the transaction for each individual use of ExecuteAsync() but not to wrap them up as a unit pf work.
public async Task UpdateCatName(CatNameUpdateDbModel chat)
{
if (cat == null)
throw new ArgumentNullException(nameof(cat));
// start Unit Of Work
await _dbClient.ExecuteAsync(DbConstants.SpUpdateCatName,
new
{
catName = cat.CatName,
},
DbConstants.DbConnectionTimeout,
CommandType.StoredProcedure,
Transaction);
await _dbClient.ExecuteAsync(DbConstants.SpUpdateCatNameAuditLog,
new
{
catNameAuditLog = cat.CatNameAuditLog,
},
DbConstants.DbConnectionTimeout,
CommandType.StoredProcedure,
Transaction);
// End Unit Of Work
// If either Stored procedure is not successfully completed then bother are rolled back
}
Look for some help :)
I have multiple stored procedures in MS SQL Server which in themselves are defined as transactions.
In my repository I want to call multiple ExecuteAsync() on stored procedures but for them to be wrapped in a unit of work.
I have managed to implement the transaction for each individual use of ExecuteAsync() but not to wrap them up as a unit pf work.