-
Notifications
You must be signed in to change notification settings - Fork 165
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
Which property type in a DTO to expose Json data #608
Comments
Yes, your expectation is correct. We have a known issue here about issues with functions on open types. Your issue might be related to that; to confirm, can you share a bit of the code and queries that you used to get filter, select, etc. to work? |
Currently I use a type DictionaryDto object:
It is used in few objects:
I have an automapper configuration that fills this dictionary from a JSON column (named userProperties):
To allow filtering I defined a FilterBinder and have overridden the BindDynamicPropertyAccessQueryNode method. What's your feeling on this? Is there a better representation to expose this kind of field? |
@rdelmont, the issue I mentioned before was about the use of functions, and it doesn't look like you're using a function with your |
I think you're doing the right representation with your open type. I'm going to close the issue for now, but if you can provide more details on what is not working about |
Hi.
I have some Json data in a column (called userProperties) of my table [Piece] and want to expose that data as a open property in PieceDto.
Ideally the response objects would look like:
What would be the best type to use for userProperties in the DTO?
Obviously i'd like to be able to filter/select/search in userProperties using requests as follow:
GET Pieces?$filter=userProperties/property1 eq 'some value'
GET Pieces?$search=another
I thought using an open type DictionaryDto based on Dictionary<string, object> or using a JsonDocument but struggle to get filter/select/search to work.
Do you have any thought on that?
The text was updated successfully, but these errors were encountered: