-
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
[Cosmos] Support collections of scalar types #4179
Comments
EF doesn't support storing collections of scalar types. The best workaround at the moment would be to add |
Any tips on how I could configure EF Core to always map I.e. custom mapping, serializing and parsing based on type (that is, general - not based on property per se). |
Note: there are two potential approaches to solving this problem:
We may choose to implement either one or both of these. The first can be done manually without mich code using a custom value converter. For example: modelBuilder
.Entity<User>()
.Property(e => e.Roles)
.HasConversion(
v => string.Join(',', v),
v => v.Split(',', StringSplitOptions.None)); (Note that this is a naive serialization that doesn't account for the separator character being included in some of the values, but using something more robust, such as JSON serialization, is just a matter of plugging in the right serialization code.) |
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
* Consolidate primitive collections across relational and Cosmos 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 * Remove dead files * Updates based on review feedback
An entity class with a property of List or ICollection of Int does not work.
Here is the error message.
The property 'RowValues' on entity type 'Models.Foo' has not been added to the model or ignored.
Is this a bug or am I doing this wrong?
Thanks
The text was updated successfully, but these errors were encountered: