Skip to content

Fixed serialisation issue in samples using Newtonsoft Json.NET

Compare
Choose a tag to compare
@oskardudycz oskardudycz released this 03 Dec 18:31
· 518 commits to main since this release

It seems that during the .NET upgrade, I broke Newtonsoft Json.NET serialisation. I removed the usage of JsonConstructor and NuGet that extended Json.NET with private constructors. Unfortunately, the test suite was not strong enough. That was strengthened up in this release.

I added ContractResolver which enables private non-default constructors.

Details

  • Added JsonObjectContractProvider that resolves Json object constructor, to support non-default, private constructor by default.
  • Moved JSONserialisationn to dedicated project to be able to not have a dependency on Core in the Test project,
  • Added default JsonSerializerSettings and used in Newtonsoft related projects,
  • Added NonDefaultConstructorContractResolver and NonDefaultConstructorMartenJsonNetContractResolver that use JsonObjectContractProvider internally
  • Added missing tests for Cart Confirmation and Adding Product in Marten ECommerce Sample.
  • Updated Requests classes to records in Marten ECommerce Sample.

Note: JsonObjectContractProvider will be added to Marten in the follow-up PR.