Trying to not promote low-level transaction implementation in initial design, IDbContext is the place for db-transactions.
public interface IDbContext
{
void Commit();
void Rollback();
}
Using "Generics" to implement "Unit Of Work"
public interface IUnitOfWork<T> where T: IDbContext
{
T DbContext { get; }
}
Now the async version of IUnitOfWork
public interface IAsyncUnitOfWork: IUnitOfWork<IDbContext>
{
Task CommitAsync(CancellationToken cancellationToken);
Task BeginTransactionAsync(CancellationToken cancellationToken);
}
Trying to implement abstract system with our setup.
public abstract class AbstractUnitOfWork: IAsyncUnitOfWork
{
public abstract IDbContext DbContext {get; set; }
public AbstractUnitOfWork(IDbContext context)
{
DbContext = context;
}
public abstract Task BeginTransactionAsync(CancellationToken cancellationToken);
public abstract Task CommitAsync(CancellationToken cancellationToken);
}
Trying to not promote low-level transaction implementation in initial design, IDbContext is the place for db-transactions.
public interface IDbContext
{
void Commit();
void Rollback();
}
public interface IUnitOfWork<T> where T: IDbContext
{
T DbContext { get; }
}
Now the async version of IUnitOfWork
public interface IAsyncUnitOfWork: IUnitOfWork<IDbContext>
{
Task CommitAsync(CancellationToken cancellationToken);
Task BeginTransactionAsync(CancellationToken cancellationToken);
}
Trying to implement abstract system with our setup.
public abstract class AbstractUnitOfWork: IAsyncUnitOfWork
{
public abstract IDbContext DbContext {get; set; }
public AbstractUnitOfWork(IDbContext context)
{
DbContext = context;
}
public abstract Task BeginTransactionAsync(CancellationToken cancellationToken);
public abstract Task CommitAsync(CancellationToken cancellationToken);
}
Trying to not promote low-level transaction implementation in initial design, IDbContext is the place for db-transactions.
public interface IDbContext
{
void Commit();
void Rollback();
}
Using "Generics" to implement "Unit Of Work"
public interface IUnitOfWork<T> where T: IDbContext
{
T DbContext { get; }
}
Now the async version of IUnitOfWork
public interface IAsyncUnitOfWork: IUnitOfWork<IDbContext>
{
Task CommitAsync(CancellationToken cancellationToken);
Task BeginTransactionAsync(CancellationToken cancellationToken);
}
Trying to implement abstract system with our setup.
public abstract class AbstractUnitOfWork: IAsyncUnitOfWork
{
public abstract IDbContext DbContext {get; set; }
public AbstractUnitOfWork(IDbContext context)
{
DbContext = context;
}
public abstract Task BeginTransactionAsync(CancellationToken cancellationToken);
public abstract Task CommitAsync(CancellationToken cancellationToken);
}
Trying to not promote low-level transaction implementation in initial design, IDbContext is the place for db-transactions.
public interface IDbContext
{
void Commit();
void Rollback();
}
public interface IUnitOfWork<T> where T: IDbContext
{
T DbContext { get; }
}
Now the async version of IUnitOfWork
public interface IAsyncUnitOfWork: IUnitOfWork<IDbContext>
{
Task CommitAsync(CancellationToken cancellationToken);
Task BeginTransactionAsync(CancellationToken cancellationToken);
}
Trying to implement abstract system with our setup.
public abstract class AbstractUnitOfWork: IAsyncUnitOfWork
{
public abstract IDbContext DbContext {get; set; }
public AbstractUnitOfWork(IDbContext context)
{
DbContext = context;
}
public abstract Task BeginTransactionAsync(CancellationToken cancellationToken);
public abstract Task CommitAsync(CancellationToken cancellationToken);
}
Trying to not promote low-level transaction implementation in initial design, IDbContext is the place for db-transactions.
public interface IDbContext
{
void Commit();
void Rollback();
}
public interface IUnitOfWork<T> where T: IDbContext
{
T DbContext { get; }
}
Now the async version of IUnitOfWork
public interface IAsyncUnitOfWork: IUnitOfWork<IDbContext>
{
Task CommitAsync(CancellationToken cancellationToken);
Task BeginTransactionAsync(CancellationToken cancellationToken);
}
Trying to implement abstract system with our setup.
public abstract class AbstractUnitOfWork: IAsyncUnitOfWork
{
public IDbContext DbContext {get;}
public AbstractUnitOfWork(IDbContext context)
{
DbContext = context;
}
public abstract Task BeginTransactionAsync(CancellationToken cancellationToken);
public abstract Task CommitAsync(CancellationToken cancellationToken);
}
Trying to not promote low-level transaction implementation in initial design, IDbContext is the place for db-transactions.
public interface IDbContext
{
void Commit();
void Rollback();
}
public interface IUnitOfWork<T> where T: IDbContext
{
T DbContext { get; }
}
Now the async version of IUnitOfWork
public interface IAsyncUnitOfWork: IUnitOfWork<IDbContext>
{
Task CommitAsync(CancellationToken cancellationToken);
Task BeginTransactionAsync(CancellationToken cancellationToken);
}
Trying to implement abstract system with our setup.
public abstract class AbstractUnitOfWork: IAsyncUnitOfWork
{
public abstract IDbContext DbContext {get; set; }
public AbstractUnitOfWork(IDbContext context)
{
DbContext = context;
}
public abstract Task BeginTransactionAsync(CancellationToken cancellationToken);
public abstract Task CommitAsync(CancellationToken cancellationToken);
}
Trying to not promote low-level transaction implementation in initial design, IDbContext is the place for db-transactions.
public interface IDbContext
{
void Commit();
void Rollback();
}
public interface IUnitOfWork<T> where T: IDbContext
{
T DbContext { get; }
}
Now the async version of IUnitOfWork
public interface IAsyncUnitOfWork: IUnitOfWork<IDbContext>
{
Task CommitAsync(CancellationToken cancellationToken);
Task BeginTransactionAsync(CancellationToken cancellationToken);
}
Trying to implement abstract system with our setup.
public abstract class AbstractUnitOfWork: IAsyncUnitOfWork
{
public IDbContext DbContext {get;}
public AbstractUnitOfWork(IDbContext context)
{
DbContext = context;
}
public abstract Task BeginTransactionAsync(CancellationToken cancellationToken);
public abstract Task CommitAsync(CancellationToken cancellationToken);
}