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

Fix deserialisation of responses #6

Merged

Conversation

qmfrederik
Copy link
Contributor

The Result property of the CommandResponse<T> object was never being assigned in my case.

I tracked it down to Result having a private setter, which Newtonsoft.Json apparently never tries to assign values to (at least in the most recent versions).

You can workaround this by creating a custom ContractResolver.

This PR implements that behavior, and allows for the creators of the CommandResponseFactory to pass a customer serializer if they so desire. I also made the MessageContractResolver you ship public, as I for example wanted to re-use that one in my code (I manually serialize the CommandRequests to the wire).

I added a unit test which can act as a non-regression test for this fix.

…e that properties with private setters have their values set, too.
@qmfrederik
Copy link
Contributor Author

I think this is actually the same issue as #4, so this PR should help you resolve that one, too.

@qmfrederik
Copy link
Contributor Author

... and probably this solves #1 as well :)

@brewdente
Copy link
Member

This is great news! I noticed that the build failed. Is it easily fixable?

@brewdente brewdente merged commit 27d0b06 into MasterDevs:master Aug 3, 2016
@qmfrederik qmfrederik deleted the fixes/commandresponsefactory branch August 4, 2016 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants