dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.09k stars 2.03k forks source link

Table Storage Transaction Provider Uses Newtonsoft #8390

Open NSTA1 opened 1 year ago

NSTA1 commented 1 year ago

I have an Orleans 7 project which has a number of data types.

I generate serializers for them as recommended using [GenerateSerializer] and have unit tests to show that they are correctly dehydrated/hydrated by the Orleans serializer.

However, some of these data types participate in transactions using the Azure table storage transaction provider. This provider would appear to use the Newtonsoft json serializer and as a result, one of my types does not work when deserializing from table storage... do I have to add Newtonsoft serialization support for my type, or is there a way to configure the storage provider to use the Orleans serializer? (The latter would be preferable)

Many Thanks 👍

benjaminpetit commented 1 year ago

AzureTableTransactionalStateStorage use only the Newtonsoft json serializer.

You will have to add json serialization support for your type. Maybe in a next release we could enable the choice of the serializer to use?

NSTA1 commented 1 year ago

It took me a while to work out that this was the issue (it's effectively a hidden dependency on Newtonsoft - given that the other parts of the system now use a different serializer, it's not immediately obvious).

It might even be good to make this package use the Orleans serializer as the default - in order to be consistent with the ecosystem? (with the option to revert to Newtonsoft). That would be a very helpful change.

Thank you for your prompt reply!

jerviscui commented 1 month ago

Is there another provider for Transaction? pgsql?

Can I set different State to store in different tables?