OfX v8.2.2
OfX v8.2.2 Release Notes
Release Date: January 18, 2026
Overview
OfX v8.2.2 is a stability release that fixes a critical EF Core concurrency issue caused by DbContext reuse across concurrent requests.
Highlights
EF Core Concurrent Issue Fix
Fixed a critical bug where concurrent requests could cause EF Core errors due to DbContext being shared across multiple operations.
The Problem:
When multiple requests were processed simultaneously, they could share the same DbContext instance, leading to:
InvalidOperationException: A second operation started on this context before a previous operation completed- Race conditions in query execution
- Inconsistent data retrieval
The Solution:
The EfQueryHandler now creates a new DI scope for each request, ensuring each operation gets its own DbContext instance.
// Before: Shared DbContext across concurrent requests
var dbContext = serviceProvider.GetRequiredService<TDbContext>();
// After: New scope per request
using var scope = serviceProvider.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<TDbContext>();Thread Safety Guaranteed
| Scenario | Before | After |
|---|---|---|
| Concurrent requests | Race condition risk | Isolated DbContext |
| Parallel queries | Shared state issues | Thread-safe |
| High load | Intermittent failures | Stable performance |
Technical Details
How It Works
- Each request creates a new
IServiceScope - The scope provides a fresh DbContext instance
- The scope is disposed after the request completes
- No shared state between concurrent operations
Scope Lifetime
Request 1 ─→ [Scope 1] ─→ [DbContext 1] ─→ Query ─→ Dispose
Request 2 ─→ [Scope 2] ─→ [DbContext 2] ─→ Query ─→ Dispose
Request 3 ─→ [Scope 3] ─→ [DbContext 3] ─→ Query ─→ Dispose
Each request is completely isolated from others.
Files Changed
src/OfX.EntityFrameworkCore/EfQueryHandler.cs- Added scope creation per request
Upgrade Guide
This is a non-breaking patch release. Simply update the NuGet package:
dotnet add package OfX.EntityFrameworkCore --version 8.2.2No code changes required. The fix is automatic.