Skip to content

Commit a96b894

Browse files
author
github-actions
committed
Documentation update
1 parent 299fa09 commit a96b894

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

docs/migrations/migration8/index.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,35 @@ <h3 id="30-noclrmapping-extension-for-input-fields-with-custom-clr-mapping-from-
11121112
the <code class="language-text">Age</code> field is processed via the standard mapping mechanism by calling <code class="language-text">base.ParseDictionary</code>.
11131113
This approach allows you to seamlessly mix automatic and custom binding, providing greater
11141114
flexibility in how your input objects are processed and mapped.</p>
1115+
<h3 id="31-unique-cache-keys-for-multi-schema-environments-from-version-840" style="position:relative;"><a href="#31-unique-cache-keys-for-multi-schema-environments-from-version-840" aria-label="31 unique cache keys for multi schema environments from version 840 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>31. Unique Cache Keys for Multi-Schema Environments (from version 8.4.0)</h3>
1116+
<p>Document caching now supports unique cache keys for applications using multiple or dynamic
1117+
schemas. The cache key has been enhanced to include an extra property computed by the new
1118+
<code class="language-text">AdditionalCacheKeySelector</code> delegate. By default, this delegate distinguishes between
1119+
schema-first and code-first implementations by returning the schema instance for
1120+
schema-first and dynamic schemas (those that are direct implementations of
1121+
<code class="language-text">Schema</code>), and the schema type for code-first and type-first schemas (schemas that derive
1122+
from <code class="language-text">Schema</code>). This change ensures that cached documents are uniquely identified even
1123+
when multiple schemas are configured in the same application, while still supporting
1124+
caching for scoped code-first and type-first schemas.</p>
1125+
<p>To migrate, you may continue using the default behavior. However, if you need further
1126+
customization -- such as incorporating additional context to identify unique dynamic schemas
1127+
-- you can override the default selector as shown in the example below:</p>
1128+
<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
1129+
<span class="token punctuation">.</span><span class="token function">UseMemoryCache</span><span class="token punctuation">(</span>options <span class="token operator">=></span>
1130+
<span class="token punctuation">{</span>
1131+
options<span class="token punctuation">.</span>AdditionalCacheKeySelector <span class="token operator">=</span> execOptions <span class="token operator">=></span>
1132+
<span class="token punctuation">{</span>
1133+
<span class="token keyword">if</span> <span class="token punctuation">(</span>execOptions<span class="token punctuation">.</span>UserContext <span class="token keyword">is</span> <span class="token class-name">IDictionary<span class="token punctuation">&lt;</span><span class="token keyword">string</span><span class="token punctuation">,</span> <span class="token keyword">object</span><span class="token punctuation">></span></span> context <span class="token operator">&amp;&amp;</span>
1134+
context<span class="token punctuation">.</span><span class="token function">TryGetValue</span><span class="token punctuation">(</span><span class="token string">"CustomHeader"</span><span class="token punctuation">,</span> <span class="token keyword">out</span> <span class="token class-name"><span class="token keyword">var</span></span> header<span class="token punctuation">)</span><span class="token punctuation">)</span>
1135+
<span class="token punctuation">{</span>
1136+
<span class="token keyword">return</span> header<span class="token punctuation">;</span>
1137+
<span class="token punctuation">}</span>
1138+
<span class="token keyword">return</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
1139+
<span class="token punctuation">}</span><span class="token punctuation">;</span>
1140+
<span class="token punctuation">}</span><span class="token punctuation">)</span>
1141+
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
1142+
<p>These changes help ensure that cached documents are correctly associated with the appropriate
1143+
schema when multiple schemas are in use.</p>
11151144
<h2 id="breaking-changes" style="position:relative;"><a href="#breaking-changes" aria-label="breaking changes permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Breaking Changes</h2>
11161145
<h3 id="1-query-type-is-required" style="position:relative;"><a href="#1-query-type-is-required" aria-label="1 query type is required permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>1. Query type is required</h3>
11171146
<p>Pursuant to the GraphQL specification, a query type is required for any schema.

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)