-
Notifications
You must be signed in to change notification settings - Fork 23
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
Mapping JsonMergePatchDocument when working with DTO #16
Comments
I am working on the same issue now. |
I never thought about this use case. ApplyTo is based on duck typing.
None of these solutions is thread safe, but I guess it is not a big deal since it is parsed from JSON anyway. I personally tend to implement option 3) but let me know if you have any other ideas. |
Option 3 looks fine. |
Implemented in 2.0.0-beta08 |
Thank you for this project!
I want to implement a partial update for my domain model, but I don't want to expose this model to the outside world and restrict what fields could be updated. It could be achieved with DTO.
As described in this stackoverflow answer, it is possible to use automapper to map
JsonPatchDocument<AccountDTO>
toJsonPatchDocument<Account>
It works when map
JsonMergePatchDocument.JsonPatchDocument
in such way - all operations are mapped.But when I map
JsonMergePatchDocument
, operations are not mapped and lost.I guess, I cant use
JsonPatchDocument
directly, because it needs to go throughClearAddOperation
procedure.Please, suggest how can I use JsonMergePatchDocument with DTOs and automapper?
The text was updated successfully, but these errors were encountered: