mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-09-30 18:29:36 +02:00
db: refactor to only init mongo client & collections once
This commit is contained in:
1 parent
c5b41be2fd
commit
99f095babe
4 files changed
+23
-57
No files matched your search
@@ -23,24 +23,16 @@ using Streetwriters.Data.Interfaces;
|
||||
|
||||
namespace Streetwriters.Data
|
||||
{
|
||||
public class UnitOfWork : IUnitOfWork
|
||||
public class UnitOfWork(IDbContext dbContext) : IUnitOfWork
|
||||
{
|
||||
private readonly IDbContext dbContext;
|
||||
|
||||
public UnitOfWork(IDbContext _dbContext)
|
||||
{
|
||||
dbContext = _dbContext;
|
||||
}
|
||||
|
||||
public async Task<bool> Commit()
|
||||
{
|
||||
var changeAmount = await dbContext.SaveChanges();
|
||||
return changeAmount > 0;
|
||||
return await dbContext.SaveChanges() > 0;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.dbContext.Dispose();
|
||||
dbContext.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user