Skip to content

Commit e5d91a1

Browse files
Update migration guide
1 parent b9fb6b2 commit e5d91a1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@ builder.Services.AddGraphQLServer()
5555
+ });
5656
```
5757

58+
If you were previously accessing `IDocumentCache` through the root service provider, you now need to access it through the schema-specific service provider instead.
59+
To populate the document cache during startup, create a custom `IRequestExecutorWarmupTask` that injects `IDocumentCache`:
60+
61+
```csharp
62+
builder.Services
63+
.AddGraphQLServer()
64+
.AddWarmupTask<MyWarmupTask>();
65+
66+
public class MyWarmupTask(IDocumentCache cache) : IRequestExecutorWarmupTask
67+
{
68+
public bool ApplyOnlyOnStartup => false;
69+
70+
public async Task WarmupAsync(
71+
IRequestExecutor executor,
72+
CancellationToken cancellationToken)
73+
{
74+
// Modify the cache
75+
}
76+
}
77+
```
78+
5879
## MaxAllowedNodeBatchSize & EnsureAllNodesCanBeResolved options moved
5980

6081
```diff

0 commit comments

Comments
 (0)