Skip to content

Commit 38f1e7c

Browse files
committed
Refactor: Use null-coalescing assignment for _dbContext initialization in UnitOfWork
1 parent 242431b commit 38f1e7c

File tree

1 file changed

+1
-1
lines changed
  • src/CodeOfChaos.Extensions.EntityFrameworkCore/UnitOfWork

1 file changed

+1
-1
lines changed

src/CodeOfChaos.Extensions.EntityFrameworkCore/UnitOfWork/UnitOfWork.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async virtual ValueTask<TDbContext> GetDbContextAsync(CancellationToken c
4141
}
4242
}
4343

44-
public virtual TDbContext GetDbContext() => _lazyDb.Value;
44+
public virtual TDbContext GetDbContext() => _dbContext ??= _lazyDb.Value;
4545

4646
public virtual bool TryCreateTransaction() {
4747
if (_transaction != null) return false;

0 commit comments

Comments
 (0)