Closed wassim-k closed 1 year ago
The serializer already exists, but is coupled to json now. Should be easy to change it return BsonDocument now.
But I would probably go with BsonValue instead of BsonDocument to support scalars line int
, `string and so on. Do you want to provide a PR for that?
Is it okay to introduce a breaking change by changing the current definition of IGrainStateSerializer
?
For 4.0...yes
Sounds good, once the 4.0 changes are merged, I'll raise a PR for this.
Great. I am not planning any migration before Orleans 4.0 is released. So nothing for prereleases.
Just a heads up, the work on this is already done, let me know when it's time to merge it into the 7.0 migration.
Currently, this provider only supports using Json.NET for serializing grain state to MongoDB.
It would be great to support the option to use BSON Serializer shipped with mongodb driver instead, since it has great documentation, support and many features that are specific for mongo db storage.
For example a more generic interface like this one might serve the purpose:
Current implementation can be achieved with something like this:
And finally using BSON Serializer can be done like this:
The one issue I can see with using BSON Serialize is the lack of support for some Json.NET Converters that are implemented by Orleans, but I believe it wouldn't be too difficult to implement those converters using BSON Serializer, and I'd gladly contribute that work to your repo if you're happy with this feature suggestion.