Skip to content
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

Primitive collections #30731

Open
22 of 34 tasks
Tracked by #240
roji opened this issue Apr 19, 2023 · 5 comments
Open
22 of 34 tasks
Tracked by #240

Primitive collections #30731

roji opened this issue Apr 19, 2023 · 5 comments
Labels
Milestone

Comments

@roji
Copy link
Member

roji commented Apr 19, 2023

This user story tracks support for primitive collections, i.e. the ability to map a property of type int[] to the database, as a JSON array (by default). Where supported, such collections are also fully queryable via the regular LINQ operators.

As a by-product of this, the translation for intParam.Contains(b => b.Property) would be changed from the current IN with constants translation to a string parameter containing an JSON array, which would be unpacked at the database and queried via the standard means. This resolves #13617, which is a long-standing, highly-voted performance issue.

Done in 8.0

Done in 9.0

Backlog

Related issues

@roji roji added type-enhancement customer-reported User Story A single user-facing feature. Can be grouped under an epic. labels Apr 19, 2023
@ajcvickers ajcvickers added composite-issue A grouping of multiple related issues into one issue and removed User Story A single user-facing feature. Can be grouped under an epic. labels Apr 19, 2023
@ajcvickers ajcvickers added this to the Backlog milestone Apr 19, 2023
@vchirikov
Copy link

vchirikov commented Aug 15, 2024

@roji I'm sorry to bother you, I found that builder.OwnsMany(x => x.ListOfStructsProperty, x => x.ToJson()); doesn't work on net8.0 and I didn't find the issue to track. Should I create it or the issue is already here somewhere?

@roji
Copy link
Member Author

roji commented Aug 15, 2024

@AndriySvyryd do we have an issue already tracking this? I found #28861 but that seems to be something else (am still not sure exactly what though 😅 )

In any case, we're likely to work on mapping JSON through complex types (as opposed to owned entities), and should make that work there - JSON mapping via owned entity types is likely to be de-prioritized.

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Aug 15, 2024

@vchirikov Mapping owned collections to JSON is generally supported. Can you open a new issue that shows the types being mapped, the error that you get and how you expect the JSON to look?

Oh, I see now. We only allow structs to be mapped as complex types. So as @roji mentioned, be on the lookout for #31252 and #31411

@zN3utr4l
Copy link

Do you have any suggestions for implementing a List<List< int>>? since it doesn't work with OwnsMany either.

#33913

@roji
Copy link
Member Author

roji commented Aug 20, 2024

@zN3utr4l nested primitive collection support is tracked by #30713 - that's not currently supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants