bgmulinari / B1SLayer

A lightweight SAP Business One Service Layer client for .NET
MIT License
122 stars 42 forks source link

Updating Values to Null #63

Closed simonechiave closed 4 months ago

simonechiave commented 4 months ago

Hello! Thanks for your amazing work.

We are facing an issue with updating some values to null with a patch request. Seems that null values are ignored and the old database value is mantained after the request give us succesfull code. Is this by design or has already be solved in any manner?

The same call performed through postman manage to update the value to null as expected so i guess the responsible code must lie between your package or the flurl library that you use under the hood

Thanks!

bgmulinari commented 4 months ago

Hi, @simonechiave. By default, the JSON serializer settings are set to ignore null values.

You can change this behavior on a per request basis with the extension method IncludeNullValues() on your request, or you can set custom serialization rules with the extension method WithJsonSerializerOptions().

simonechiave commented 4 months ago

Super! thanks