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

Add type-mapping to data objects using the WCF DataContract attribute. #264

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

mvriel
Copy link
Contributor

@mvriel mvriel commented Sep 24, 2024

Newtonsoft JSON.net supports the DataContract attribute, but doesn't support the name and namespace members. By adding our own SerializationBinder, we can pick up on the name and namespace member and use that as a type declaration for in the JSON output.

Through this mechanism, we can ensure that changes in the naming or namespaces of classes do not affect project files stored after this change. As long as the DataContract name and namespace doesn't change the application will always be able to find the associated class.

As a namespace, we have followed LinkedData recommendations by using a URL. Later on we could even add LD schema's at those locations but let's not get ahead of ourselves :)

Newtonsoft JSON.net supports the DataContract attribute, but doesn't support the name and namespace members. By adding our own SerializationBinder, we _can_ pick up on the name and namespace member and use that as a type declaration for in the JSON output.

Through this mechanism, we can ensure that changes in the naming or namespaces of classes do not affect project files stored after this change. As long as the DataContract name and namespace doesn't change the application will always be able to find the associated class.

As a namespace, we have followed LinkedData recommendations by using a URL. Later on we could even add LD schema's at those locations but let's not get ahead of ourselves :)
@mvriel mvriel marked this pull request as ready for review September 24, 2024 12:09
@mvriel mvriel merged commit 6767e09 into main Sep 24, 2024
2 checks passed
@mvriel mvriel deleted the feature/add-typemapping-to-serialized-entries branch September 24, 2024 12:56
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