Transaction Support (#309)
* Added transactions to UnitOfWork and refactored code to use it. * This included blank UI fix from Kavita-webui
This commit is contained in:
parent
d2e444910d
commit
6e1b227e65
11 changed files with 168 additions and 124 deletions
|
@ -30,7 +30,11 @@ namespace API.Data
|
|||
public IAppUserProgressRepository AppUserProgressRepository => new AppUserProgressRepository(_context);
|
||||
public ICollectionTagRepository CollectionTagRepository => new CollectionTagRepository(_context, _mapper);
|
||||
|
||||
public async Task<bool> Complete()
|
||||
public bool Commit()
|
||||
{
|
||||
return _context.SaveChanges() > 0;
|
||||
}
|
||||
public async Task<bool> CommitAsync()
|
||||
{
|
||||
return await _context.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
@ -39,5 +43,16 @@ namespace API.Data
|
|||
{
|
||||
return _context.ChangeTracker.HasChanges();
|
||||
}
|
||||
|
||||
public async Task<bool> RollbackAsync()
|
||||
{
|
||||
await _context.DisposeAsync();
|
||||
return true;
|
||||
}
|
||||
public bool Rollback()
|
||||
{
|
||||
_context.Dispose();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue