-
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
Support read-only collections of primitive types #31722
Comments
Confirmed that the above is a regression from preview.7 to rc.1. @ajcvickers @maumar is one of you interested in taking a look? Seems to be materialization-related. |
@roji Did you try it on the latest daily build? |
@ajcvickers yeah, sorry, I should have been clearer - this fails on the latest release/8.0 commit (a4db3b7) with the same exception. |
culptit: #31272 EntityMaterializerSource -> CreateMemberAssignment PopulateList is trying to add elements from buffer to the target, but that's not allowed for read only collections. |
I missed this was a read-only collection. We don't support read-only collections in EF 8. We should throw a better exception. (They weren't fully functional in earlier EF8 previews, they just didn't throw.) |
…as a primitive collection Part of #31722
See also #25364 when fixing this. |
This change starts using the EF8 primitive collection infrastructure for primitive collections in Cosmos. This involves adding support for nested collections and read-only collections. The main challenge here is supporting all the different collection types when, for example, `List<List<string>>` cannot be cast to `IEnumerable<IEnumerable<string>>`. To support this, we use exact collection types in snapshots, and we use non-generic methods in the nested comparers and serializers. General dictionary mapping still not supported. No extensive query testing done yet. Model building and change tracking for #30713 Fixes #25364 Fixes #25343 Part of #4179 Fixes #31722
This change starts using the EF8 primitive collection infrastructure for primitive collections in Cosmos. This involves adding support for nested collections and read-only collections. The main challenge here is supporting all the different collection types when, for example, `List<List<string>>` cannot be cast to `IEnumerable<IEnumerable<string>>`. To support this, we use exact collection types in snapshots, and we use non-generic methods in the nested comparers and serializers. General dictionary mapping still not supported. No extensive query testing done yet. Model building and change tracking for #30713 Fixes #25364 Fixes #25343 Part of #4179 Fixes #31722
But it throws the error even with |
File a bug
With the latest
rc1
, there is a regression if an object uses aIReadOnlyCollection<string>
(or any other primitive type that can be mapped to JSON inside the column). The following code will throw exceptions, that were not existing onpreview-7
:Stack-Trace:
Include verbose output
The project is using
net8.0-rc.1
.Include provider and version information
EF Core version:
Database provider: Microsoft.EntityFrameworkCore.Sqlite
Target framework:: .NET 8.0
Operating system: MacOS
IDE: -
The text was updated successfully, but these errors were encountered: