You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -236,6 +236,60 @@ public class CustomRequestMiddleware
236
236
}
237
237
```
238
238
239
+
## IRequestExecutorResolver split into provider, events, and manager
240
+
241
+
The single `IRequestExecutorResolver` interface from v15 has been removed and its responsibilities split across three more focused abstractions in `HotChocolate.Execution.Abstractions`:
`IRequestExecutorManager` derives from `IRequestExecutorProvider`, so inject the manager when you need both lookup and eviction, the provider when you only need lookup, and `IRequestExecutorEvents` when you only need to react to executor lifecycle events:
250
+
251
+
```diff
252
+
-public class MyService(IRequestExecutorResolver resolver)
253
+
+public class MyService(
254
+
+ IRequestExecutorManager executors,
255
+
+ IRequestExecutorEvents events)
256
+
{
257
+
- public ValueTask<IRequestExecutor> GetExecutorAsync(CancellationToken ct)
- public void EvictDefault() => resolver.EvictRequestExecutor();
263
+
+ public void EvictDefault() => executors.EvictExecutor();
264
+
265
+
- public IDisposable Subscribe(IObserver<RequestExecutorEvent> observer)
266
+
- => resolver.Events.Subscribe(observer);
267
+
+ public IDisposable Subscribe(IObserver<RequestExecutorEvent> observer)
268
+
+ => events.Subscribe(observer);
269
+
}
270
+
```
271
+
272
+
The `IServiceProvider.GetRequestExecutorAsync(...)` extension method has been kept as a convenience and now resolves `IRequestExecutorProvider` from the container internally, so call sites such as `services.GetRequestExecutorAsync()` continue to compile unchanged.
273
+
274
+
The legacy `RequestExecutorEvicted` event (already marked obsolete in v15) has been removed; subscribe to `IRequestExecutorEvents` and filter on `RequestExecutorEventType.Evicted` instead.
275
+
276
+
## RequestExecutorProxy
277
+
278
+
`RequestExecutorProxy` still exists and serves the same purpose, giving you a long-lived handle to the executor for a particular schema that is hot-swapped automatically when the schema is rebuilt. Two things have changed:
279
+
280
+
**Constructor signature.** The proxy no longer takes an `IRequestExecutorResolver`; it now takes the new provider and events abstractions explicitly:
281
+
282
+
```diff
283
+
-var proxy = new RequestExecutorProxy(resolver, "Schema");
284
+
+var proxy = new RequestExecutorProxy(executorProvider, executorEvents, "Schema");
285
+
```
286
+
287
+
**The proxy now implements `IRequestExecutor`.** You can pass a `RequestExecutorProxy` directly anywhere an `IRequestExecutor` is expected, without first calling `GetRequestExecutorAsync()`. `ExecuteAsync` and `ExecuteBatchAsync` resolve the current executor internally.
288
+
289
+
The CLR events `ExecutorUpdated` and `ExecutorEvicted` have been removed. If you need to react to swaps, derive from `RequestExecutorProxy` and override `OnConfigureRequestExecutor(newExecutor, oldExecutor)` (runs under the proxy's lock, before `CurrentExecutor` is replaced) or `OnAfterRequestExecutorSwapped(newExecutor, oldExecutor)` (runs after the swap, outside the lock).
290
+
291
+
The separate `AutoUpdateRequestExecutorProxy` helper has been removed; the base `RequestExecutorProxy` now subscribes to executor events on construction and updates `CurrentExecutor` automatically.
292
+
239
293
## Schema.DefaultName moved to ISchemaDefinition.DefaultName
240
294
241
295
The `Schema.DefaultName` constant is no longer available in v16.
0 commit comments