Refactor AdoNetTGrainStorage serialization configuration
Currently AdoNetGrainStorage use two bool to determine which serializer to us, see below:
#region json serialization related settings
/// <summary>
/// Whether storage string payload should be formatted in JSON.
/// <remarks>If neither <see cref="UseJsonFormat"/> nor <see cref="UseXmlFormat"/> is set to true, then BinaryFormatSerializer will be configured to format storage string payload.</remarks>
/// </summary>
public bool UseJsonFormat { get; set; }
public bool UseFullAssemblyNames { get; set; }
public bool IndentJson { get; set; }
public TypeNameHandling? TypeNameHandling { get; set; }
#endregion
/// <summary>
/// Whether storage string payload should be formatted in Xml.
/// <remarks>If neither <see cref="UseJsonFormat"/> nor <see cref="UseXmlFormat"/> is set to true, then BinaryFormatSerializer will be configured to format storage string payload.</remarks>
/// </summary>
public bool UseXmlFormat { get; set; }
Using this, user can configure AdoNetGrainStorage with JsonSerializer or xmlSerializer. If neither is configured, the system will wire up the default binary serializer.
This way of configuring isn't extensive enough to configure other serializers. And also current way of configuring is error prone. For example, the AdoNetGrainStorageOptions class doesn't prevent you from set both UseXml and UseJson to be true programmatically, but in fact it is not a valid pattern.
Now orleans is well integrated with DI, I think it is time to refactor this to be in a better shape. The same situation exists in other grain storage provider too. Suggest to include this in 2.0 since it touches public interfaces.
@veikkoeeva submitted the issue about refactoring AdoNetTGrainStorage serialization configuration. We can have further discussion here if there's any.
related discussion on how this feature was originally designed : https://github.com/dotnet/orleans/pull/4022#discussion_r168587890
We are marking this issue as stale due to the lack of activity in the past six months. If there is no further activity within two weeks, this issue will be closed. You can always create a new issue based on the guidelines provided in our pinned announcement.
This issue has been marked stale for the past 30 and is being closed due to lack of activity.