-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Block nested primitive collections in relational due to lack of query support #34325
Merged
Merged
Changes from all commits
Commits
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 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
10 changes: 9 additions & 1 deletion
10
src/EFCore.Relational/Properties/RelationalStrings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 |
---|---|---|
|
@@ -7,6 +7,126 @@ namespace Microsoft.EntityFrameworkCore; | |
|
||
public abstract class JsonTypesRelationalTestBase : JsonTypesTestBase | ||
{ | ||
public override Task Can_read_write_array_of_array_of_array_of_int_JSON_values() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I hope we'll clean up all these dedicated per-type tests via #33521. |
||
=> NoNestedCollections( | ||
"int[][][]", nameof(Int32ArrayArrayArrayType), | ||
base.Can_read_write_array_of_array_of_array_of_int_JSON_values); | ||
|
||
public override Task Can_read_write_array_of_list_of_array_of_IPAddress_JSON_values() | ||
=> NoNestedCollections( | ||
"List<IPAddress[]>[]", nameof(IpAddressArrayListArrayType), | ||
base.Can_read_write_array_of_list_of_array_of_IPAddress_JSON_values); | ||
|
||
public override Task Can_read_write_array_of_list_of_array_of_string_JSON_values() | ||
=> NoNestedCollections( | ||
"List<string[]>[]", nameof(StringArrayListArrayType), | ||
base.Can_read_write_array_of_list_of_array_of_string_JSON_values); | ||
|
||
public override Task Can_read_write_array_of_list_of_binary_JSON_values(string expected) | ||
=> NoNestedCollections( | ||
"List<byte[]>[]", nameof(BinaryListArrayType), | ||
() => base.Can_read_write_array_of_list_of_binary_JSON_values(expected)); | ||
|
||
public override Task Can_read_write_array_of_list_of_GUID_JSON_values(string expected) | ||
=> NoNestedCollections( | ||
"ICollection<Guid>[]", nameof(GuidListArrayType), | ||
() => base.Can_read_write_array_of_list_of_GUID_JSON_values(expected)); | ||
|
||
public override Task Can_read_write_array_of_list_of_int_JSON_values() | ||
=> NoNestedCollections( | ||
"IList<int>[]", nameof(Int32ListArrayType), | ||
base.Can_read_write_array_of_list_of_int_JSON_values); | ||
|
||
public override Task Can_read_write_array_of_list_of_IPAddress_JSON_values() | ||
=> NoNestedCollections( | ||
"Collection<IPAddress>[]", nameof(IpAddressListArrayType), | ||
base.Can_read_write_array_of_list_of_IPAddress_JSON_values); | ||
|
||
public override Task Can_read_write_array_of_list_of_string_JSON_values() | ||
=> NoNestedCollections( | ||
"List<string>[]", nameof(StringListArrayType), | ||
base.Can_read_write_array_of_list_of_string_JSON_values); | ||
|
||
public override Task Can_read_write_array_of_list_of_ulong_JSON_values() | ||
=> NoNestedCollections( | ||
"List<ulong>[]", nameof(ULongListArrayType), | ||
base.Can_read_write_array_of_list_of_ulong_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_int_JSON_values() | ||
=> NoNestedCollections( | ||
"List<int[]>", nameof(Int32ArrayListType), | ||
base.Can_read_write_list_of_array_of_int_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_IPAddress_JSON_values() | ||
=> NoNestedCollections( | ||
"ObservableCollection<IPAddress[]>", nameof(IpAddressArrayListType), | ||
base.Can_read_write_list_of_array_of_IPAddress_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_list_of_IPAddress_JSON_values() | ||
=> NoNestedCollections( | ||
"List<List<IPAddress>[]>", nameof(IpAddressListArrayListType), | ||
base.Can_read_write_list_of_array_of_list_of_IPAddress_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_list_of_string_JSON_values() | ||
=> NoNestedCollections( | ||
"List<List<string>[]>", nameof(StringListArrayListType), | ||
base.Can_read_write_list_of_array_of_list_of_string_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_list_of_ulong_JSON_values() | ||
=> NoNestedCollections( | ||
"List<List<ulong[]>>", nameof(ULongListArrayListType), | ||
base.Can_read_write_list_of_array_of_list_of_ulong_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_nullable_int_JSON_values() | ||
=> NoNestedCollections( | ||
"List<int?[]>", nameof(NullableInt32ArrayListType), | ||
base.Can_read_write_list_of_array_of_nullable_int_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_nullable_ulong_JSON_values() | ||
=> NoNestedCollections( | ||
"List<ulong?[]>", nameof(NullableULongArrayListType), | ||
base.Can_read_write_list_of_array_of_nullable_ulong_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_string_JSON_values() | ||
=> NoNestedCollections( | ||
"List<string[]>", nameof(StringArrayListType), | ||
base.Can_read_write_list_of_array_of_string_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_ulong_JSON_values() | ||
=> NoNestedCollections( | ||
"List<ulong[]>", nameof(ULongArrayListType), | ||
base.Can_read_write_list_of_array_of_ulong_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_list_of_list_of_int_JSON_values() | ||
=> NoNestedCollections( | ||
"List<List<List<int>>>", nameof(Int32ListListListType), | ||
base.Can_read_write_list_of_list_of_list_of_int_JSON_values); | ||
|
||
public override Task Can_read_write_list_of_array_of_binary_JSON_values(string expected) | ||
=> NoNestedCollections( | ||
"IEnumerable<byte[][]>", nameof(BinaryArrayListType), | ||
() => base.Can_read_write_list_of_array_of_binary_JSON_values(expected)); | ||
|
||
public override Task Can_read_write_list_of_array_of_GUID_JSON_values(string expected) | ||
=> NoNestedCollections( | ||
"List<Guid[]>", nameof(GuidArrayListType), | ||
() => base.Can_read_write_list_of_array_of_GUID_JSON_values(expected)); | ||
|
||
public override Task Can_read_write_list_of_array_of_list_of_array_of_binary_JSON_values(string expected) | ||
=> NoNestedCollections( | ||
"List<List<byte[][]>[]>", nameof(BinaryListArrayArrayListType), | ||
() => base.Can_read_write_list_of_array_of_list_of_array_of_binary_JSON_values(expected)); | ||
|
||
public override Task Can_read_write_list_of_array_of_nullable_GUID_JSON_values(string expected) | ||
=> NoNestedCollections( | ||
"List<Guid?[]>", nameof(NullableGuidArrayListType), | ||
() => base.Can_read_write_list_of_array_of_nullable_GUID_JSON_values(expected)); | ||
|
||
private async Task NoNestedCollections(string propertyType, string entityType, Func<Task> testCode) | ||
=> Assert.Equal( | ||
RelationalStrings.NestedCollectionsNotSupported(propertyType, entityType, "Prop"), | ||
(await Assert.ThrowsAsync<InvalidOperationException>(testCode)).Message); | ||
|
||
[ConditionalTheory] | ||
[InlineData(null)] | ||
public virtual Task Can_read_write_collection_of_fixed_length_string_JSON_values(object? storeType) | ||
|
This file contains 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 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 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 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 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this for Cosmos too? Pragmatically, is it worth moving this to core given I don't think any provider supports it in 9 (though in theory one could, so some way to opt out)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided not to block it for Cosmos because nested collections of scalars where supported in EF8 on Cosmos, but not on relational. So this is not a breaking change for relational, but it would be for Cosmos, even though we don't know if any queries actually worked.