Skip to content

Commit d6bc074

Browse files
committed
Fix: Ensure lazy-initialized _dbContext fallback in UnitOfWork.GetDbContext()
1 parent 0b15c76 commit d6bc074

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)