-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MongoDB Bson Serializer #404
Comments
Hi @cmeyertons - adding MongoDB Bson support would be a fantastic addition! It would be great if you'd like to contribute this. |
Hi again @cmeyertons - is there any help you need in getting this working? |
@SteveDunn - i started working on the Orleans related support first to get started. Man, this solution is painful to build & navigate due to the huge amount of snapshots in the SnapshotTests project -- I ended up excluding those from the project via a globbing pattern and the DX is much nicer - do you have any thoughts one way or another on the manageability of the snapshots included in the VS project? The other piece that seems to missing is an Integration Testing project that references the Vogen source generator and generates actual objects so that we can test integrations w/ other source generators. In the Orleans case, that's really critical to ensure that the Vogen plays nicely w/ the Orleans source generator I'm trying to add a project to do so (this could include full Orleans tests that reference the Vogen project directly) but Visual Studio does not like the direct project reference in this solution Been playing around w/ some ideas here but no luck so far... |
Hi, yes I completely agree that the developer experience is a pain due to all of the snapshot tests. The biggest and slowest culprit of these are the ones that do permutations of the different constituents, e.g. a internal/public record/struct/class/readonly struct with combinations of converters/serializers. All repeated for every framework because there's subtle differences in the behaviour of the hoisted methods. It would be great if this pain could be eased somewhat, maybe by reducing the permutations and/or reducing the amount of frameworks that are supported. It's not only a bad DX, but it really slows down Git operations and builds take literally hours! Re, the integration tests that reference Vogen; this is tricky because you can't directly access use the source generator in the source generator solution. There is another solution called Thanks for the feedback! |
Hi @cmeyertons do you have any update on this? |
Hi @fb-smit, I did the following in my project. public class BsonSerializerAdapter<TValue, TUnderlyingTypeValue>(
IBsonSerializer<TUnderlyingTypeValue> serializer,
Func<TValue, TUnderlyingTypeValue> to,
Func<TUnderlyingTypeValue, TValue> from)
: SerializerBase<TValue>
{
public override TValue Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
=> from.Invoke(serializer.Deserialize(context, args));
public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, TValue value)
=> serializer.Serialize(context, args, to.Invoke(value));
} P.S. |
Thanks for info @shupoval - I'll take a look at incorporating that in. I'm very pleased to hear such great feedback on these projects - much appreciated! |
This will be in 4.0.16, hopefully in a day or so. Thanks all for your help with this! |
Describe the feature
Would you be open to adding an integration for MongoDB Bson serialization to the enum list of integrations?
I would be happy to help contribute this!
I was thinking we would support strongly typed serialization for the primitive types here and then default to
object
for any other typeThe text was updated successfully, but these errors were encountered: