Skip to content

Commit 897a2e5

Browse files
author
github-actions
committed
Documentation update
1 parent d063516 commit 897a2e5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/migrations/migration8/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,12 @@ <h3 id="37-code-classlanguage-textiresolvefieldcontextaccessorcode-for-accessing
12921292
from user code, similar to <code class="language-text">HttpContextAccessor</code> or <code class="language-text">DataLoaderContextAccessor</code>. This is useful when
12931293
you need to access the current field resolution context from services or other code that doesn't have
12941294
direct access to the context parameter.</p>
1295+
<p>Additionally, the <code class="language-text">IRequiresResolveFieldContextAccessor</code> interface has been added to allow resolvers
1296+
to indicate whether they require the context accessor. Resolvers that implement this interface and
1297+
return <code class="language-text">false</code> for the <code class="language-text">RequiresResolveFieldContextAccessor</code> property will not have the context accessor
1298+
middleware applied, even when <code class="language-text">AddResolveFieldContextAccessor()</code> is called globally. This provides an
1299+
optimization to avoid the overhead of the context accessor for resolvers that don't need it, such as
1300+
simple property accessors.</p>
12951301
<p>To enable the context accessor, call <code class="language-text">AddResolveFieldContextAccessor()</code> on your GraphQL builder:</p>
12961302
<div class="gatsby-highlight" data-language="csharp"><pre class="language-csharp"><code class="language-csharp">services<span class="token punctuation">.</span><span class="token function">AddGraphQL</span><span class="token punctuation">(</span>b <span class="token operator">=></span> b
12971303
<span class="token punctuation">.</span><span class="token generic-method"><span class="token function">AddSchema</span><span class="token generic class-name"><span class="token punctuation">&lt;</span>MySchema<span class="token punctuation">></span></span></span><span class="token punctuation">(</span><span class="token punctuation">)</span>

page-data/docs/migrations/migration8/page-data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)