NEventStore / NEventStore.Persistence.MongoDB

Mongo Persistence Engine for NEventStore
MIT License
22 stars 26 forks source link

Inconsistent serialization / deserialization strategies when writing and loading commits #31

Closed AGiorgetti closed 8 years ago

AGiorgetti commented 8 years ago

Look at the functions in ExtensionMethods.cs and double check how the serialization of each field was made, for example:

ToMongoCommit() at the end does: return mc.ToBsonDocument(); which uses all the configured MongoDB custom serialization conventions that can be registered.

in the ToCommit() we do something like: doc[MongoCommitFields.CommitStamp].ToUniversalTime() we are skipping any custom serialization or convention here (other fields do the same).

If you do not setup the conventions in a correct way (that is ignoring anything exposed by this driver) you will end up with runtime serialization errors.

AGiorgetti commented 8 years ago

Please review the PR: #32 as it is a fix for this issue.

Maybe we should rewrite the whole serialization and instead of writing the DSonDocument directly (as it is now) we should follow the approach that @andreabalducci used. This way we can allow the users -through the MongoDB mapping API - to change how the whole Commit is serialized.

alkampfergit commented 8 years ago

Will be closed when implementing https://github.com/NEventStore/NEventStore.Persistence.MongoDB/issues/38

AGiorgetti commented 8 years ago

closed with commit: https://github.com/NEventStore/NEventStore.Persistence.MongoDB/commit/247f5d8730b180ec03b8f638bbc77e360f9c0d5b