Skip to content

Commit fa8e775

Browse files
committed
.
1 parent 8d23072 commit fa8e775

31 files changed

Lines changed: 100 additions & 5225 deletions

File tree

docs/defining-graphs.md

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ This approach ensures that all required navigation properties are automatically
276276
<!-- snippet: ProjectedFieldBasicTransform -->
277277
<a id='snippet-ProjectedFieldBasicTransform'></a>
278278
```cs
279-
AddProjectedNavigationField<string?, string>(
279+
AddProjectedField<string?, string>(
280280
name: "propertyUpper",
281281
projection: source => source.Property,
282282
transform: property => property?.ToUpper() ?? "");
@@ -290,7 +290,7 @@ AddProjectedNavigationField<string?, string>(
290290
<!-- snippet: ProjectedFieldAsyncTransform -->
291291
<a id='snippet-ProjectedFieldAsyncTransform'></a>
292292
```cs
293-
AddProjectedNavigationField<string?, string>(
293+
AddProjectedField<string?, string>(
294294
name: "propertyUpperAsync",
295295
projection: source => source.Property,
296296
transform: async property =>
@@ -303,36 +303,17 @@ AddProjectedNavigationField<string?, string>(
303303
<!-- endSnippet -->
304304

305305

306-
### Context-Aware Transform
307-
308-
<!-- snippet: ProjectedFieldContextAwareTransform -->
309-
<a id='snippet-ProjectedFieldContextAwareTransform'></a>
310-
```cs
311-
AddProjectedNavigationField<string?, string>(
312-
name: "propertyWithContext",
313-
projection: source => source.Property,
314-
transform: (context, property) =>
315-
{
316-
var prefix = context.Source.Id.ToString()[..8];
317-
return $"{prefix}: {property ?? "null"}";
318-
});
319-
```
320-
<sup><a href='/src/Tests/IntegrationTests/Graphs/ParentGraphType.cs#L39-L50' title='Snippet source file'>snippet source</a> | <a href='#snippet-ProjectedFieldContextAwareTransform' title='Start of snippet'>anchor</a></sup>
321-
<!-- endSnippet -->
322-
323-
324306
### List Field
325307

326308
<!-- snippet: ProjectedFieldListField -->
327309
<a id='snippet-ProjectedFieldListField'></a>
328310
```cs
329-
AddProjectedNavigationListField<ChildEntity, string?, string>(
311+
AddProjectedListField<string?, string>(
330312
name: "childrenProperties",
331-
navigation: source => source.Children,
332-
projection: child => child.Property,
313+
projection: source => source.Children.Select(c => c.Property),
333314
transform: property => property ?? "empty");
334315
```
335-
<sup><a href='/src/Tests/IntegrationTests/Graphs/ParentGraphType.cs#L52-L60' title='Snippet source file'>snippet source</a> | <a href='#snippet-ProjectedFieldListField' title='Start of snippet'>anchor</a></sup>
316+
<sup><a href='/src/Tests/IntegrationTests/Graphs/ParentGraphType.cs#L45-L52' title='Snippet source file'>snippet source</a> | <a href='#snippet-ProjectedFieldListField' title='Start of snippet'>anchor</a></sup>
336317
<!-- endSnippet -->
337318

338319

@@ -341,7 +322,7 @@ AddProjectedNavigationListField<ChildEntity, string?, string>(
341322
<!-- snippet: ProjectedFieldNestedNavigation -->
342323
<a id='snippet-ProjectedFieldNestedNavigation'></a>
343324
```cs
344-
AddProjectedNavigationField<string?, string>(
325+
AddProjectedField<string?, string>(
345326
name: "level2Property",
346327
projection: source => source.Level2Entity!.Level3Entity!.Property,
347328
transform: property => property ?? "none");

docs/mdsource/defining-graphs.source.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ snippet: ProjectedFieldBasicTransform
182182
snippet: ProjectedFieldAsyncTransform
183183

184184

185-
### Context-Aware Transform
186-
187-
snippet: ProjectedFieldContextAwareTransform
188-
189-
190185
### List Field
191186

192187
snippet: ProjectedFieldListField

src/GraphQL.EntityFramework.Analyzers/DiagnosticDescriptors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static class DiagnosticDescriptors
99
public static readonly DiagnosticDescriptor ProblematicContextSourceAccess = new(
1010
id: DiagnosticId,
1111
title: "Avoid accessing non-ID properties on context.Source",
12-
messageFormat: "Property '{0}' accessed on context.Source may not be loaded. Consider using AddProjectedField/AddProjectedNavigationField instead, or access the foreign key '{1}' if available.",
12+
messageFormat: "Property '{0}' accessed on context.Source may not be loaded. Consider using AddProjectedField instead, or access the foreign key '{1}' if available.",
1313
category: "Usage",
1414
defaultSeverity: DiagnosticSeverity.Warning,
1515
isEnabledByDefault: true,

0 commit comments

Comments
 (0)