Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LinQL/SelectExtentions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static OneOf<T, TResult> On<T, TMaybe, TResult>(this OneOf<T, TResult> th
public static T SelectAll<T>(this T that) => that;

/// <summary>
/// Instruct the query to get all scalar fields on this type.
/// Extract specific fields from a type.
/// </summary>
/// <typeparam name="T">The type to select from.</typeparam>
/// <typeparam name="TResult">The type to project to.</typeparam>
Expand Down
8 changes: 8 additions & 0 deletions docs/Writing-Queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class ExampleType
public IEnumerable<string> Strings { get; set; }

public ExampleType Nested { get; set; }

[GraphQLOperation]
public ExampleType GetNestedById(int id) { get; set; }
}
```
If you were to query:
Expand Down Expand Up @@ -97,4 +100,9 @@ You can then of course do whatever you like with the results
```csharp
(await Query((Root x) => x.ExampleTypes.Select(y => new { y.Number, y.Text, IsAvailable = y.IsTrue() })))
.Where(x => x.IsAvailable).ToList();
```

Another scenario is where you have the results of an operation or a nested type that you need to retrieve fields from. In this instance you can use the `Project` helper method.
```csharp
(await Query((Root x) => new { Number = x.ExampleType.Number, Obj = x.ExampleType.GetByNumber(123).Project(y => new { y.Number, y.Text }) });
```
Loading