-
-
Notifications
You must be signed in to change notification settings - Fork 803
Avoid checking for null on non-nullable property for projection #6706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
1677d6c
Avoid checking for null on non-nullable property for projection
glen-84 df81c12
Merge branch 'main' into ga/ef-complex-types
glen-84 30d0f4e
Merge branch 'main' into ga/ef-complex-types
glen-84 91d6356
Use collection expression
glen-84 c5ace90
Merge branch 'main' into ga/ef-complex-types
glen-84 0653d59
Merge branch 'main' into ga/ef-complex-types
glen-84 00894fe
Merge branch 'main' into ga/ef-complex-types
glen-84 8c65711
Updated snapshots
glen-84 0be65e7
Removed preprocessor directive
glen-84 88577d7
Merge branch 'main' into ga/ef-complex-types
glen-84 2a5d875
Made the _nullabilityInfoContext field static
glen-84 d03cf61
Merge branch 'main' into ga/ef-complex-types
glen-84 c4ffd86
Fixed analyzer errors
glen-84 41b5b05
Updated snapshots
glen-84 7b8d5a8
Merge branch 'main' into ga/ef-complex-types
glen-84 973f000
Fix field name
glen-84 769b4a1
Remove TODO comment
glen-84 f817bc4
Address Copilot feedback
glen-84 c34ef4c
Make NullabilityInfoContext thread-safe
glen-84 dc80427
Address Copilot feedback
glen-84 b4c292e
Merge branch 'main' into ga/ef-complex-types
glen-84 b54f78e
Moved NullabilityInfoContext to projection context
michaelstaib fb166cd
Remove unnecessary value type handling
glen-84 a017b0d
Merge branch 'main' into ga/ef-complex-types
glen-84 1c4d7b6
Merge branch 'main' into ga/ef-complex-types
glen-84 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...ocolate/Data/test/Data.Projections.SqlServer.Tests/QueryableProjectionComplexTypeTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| using HotChocolate.Execution; | ||
| using Microsoft.EntityFrameworkCore; | ||
|
|
||
| namespace HotChocolate.Data.Projections; | ||
|
|
||
| public class QueryableProjectionComplexTypeTests | ||
| { | ||
| private static readonly Foo[] s_fooEntities = | ||
| [ | ||
| new() { Bar = new Bar { Baz = "testatest" } }, | ||
| new() { Bar = new Bar { Baz = "testbtest" } } | ||
| ]; | ||
|
|
||
| private readonly SchemaCache _cache = new SchemaCache(); | ||
|
|
||
| [Fact] | ||
| public async Task Create_Complex_Type() | ||
| { | ||
| // arrange | ||
| var tester = _cache.CreateSchema(s_fooEntities, OnModelCreating); | ||
|
|
||
| // act | ||
| var res1 = await tester.ExecuteAsync( | ||
| OperationRequestBuilder.New() | ||
| .SetDocument( | ||
| """ | ||
| { | ||
| root { | ||
| bar { | ||
| baz | ||
| } | ||
| } | ||
| } | ||
| """) | ||
| .Build()); | ||
|
|
||
| // assert | ||
| await Snapshot | ||
| .Create() | ||
| .AddResult(res1) | ||
| .MatchAsync(); | ||
| } | ||
|
|
||
| private static void OnModelCreating(ModelBuilder modelBuilder) | ||
| { | ||
| modelBuilder.Entity<Foo>().ComplexProperty(f => f.Bar); | ||
| } | ||
|
|
||
| public class Foo | ||
| { | ||
| public int Id { get; set; } | ||
|
|
||
| public Bar Bar { get; set; } = null!; | ||
| } | ||
|
|
||
| public record Bar | ||
| { | ||
| public string Baz { get; set; } = null!; | ||
| } | ||
| } | ||
25 changes: 25 additions & 0 deletions
25
...qlServer.Tests/__snapshots__/QueryableProjectionComplexTypeTests.Create_Complex_Type.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| Result: | ||
| --------------- | ||
| { | ||
| "data": { | ||
| "root": [ | ||
| { | ||
| "bar": { | ||
| "baz": "testatest" | ||
| } | ||
| }, | ||
| { | ||
| "bar": { | ||
| "baz": "testbtest" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| --------------- | ||
|
|
||
| SQL: | ||
| --------------- | ||
| SELECT "d"."Bar_Baz" | ||
| FROM "Data" AS "d" | ||
| --------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.