Show / Hide Table of Contents

Interface IUnitOfWork<TContext>

Interface that represents the concrete class responsible for operations outside of the DbContext.

Unit of Work is a design pattern to resolution of concurrency problems and coordinates the writing out of changes.

Inherited Members
System.IDisposable.Dispose()
Namespace: StoneCo.Framework.Data.SqlServer
Assembly: cs.temp.dll.dll
Syntax
public interface IUnitOfWork<TContext> : IDisposable where TContext : IDbContext
Type Parameters
Name Description
TContext

The type of context being operated on by this unit of work.

Methods

BeginTransaction()

Starts a new transaction.

Declaration
IDbContextTransaction BeginTransaction()
Returns
Type Description
IDbContextTransaction

A transaction against the database.

SaveChanges()

Synchronous method that confirms the modifications made to entities within the context.

Declaration
int SaveChanges()
Returns
Type Description
System.Int32

The number of state entries written to the database.

SaveChangesAsync(CancellationToken)

Asynchronous method that confirms the modifications made to entities within the context.

Declaration
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

Spreads the notification that transactions should be canceled.

Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

A task that represents the asynchronous save operation. The task result contains the number of state entries written to the database.

SetTimeOut(Int32)

Set timeout to execute the commands into context instance.

Declaration
void SetTimeOut(int timeoutInSeconds = 180)
Parameters
Type Name Description
System.Int32 timeoutInSeconds

Value that represent in seconds the timeout.

Back to top Generated by DocFX