Use custom conventions when persisting Rebus sagas in MongoDb

Ricardo Rodriguez

When I store my domain in MongoDB, I´m using a custom convention (as stated in here) in order to persist my enums as they string representation, as we found it easier when debugging.

I would like to do the same when using MongoDB as my saga storage in Rebus. Is there a way to do this?

Ricardo Rodriguez

Ok, my bad... The conventions are defined globally using the ConventionsRegistry

var conventions = new ConventionPack();
conventions.Add(new EnumSerializationConvention(BsonType.String));
ConventionRegistry.Register("Saga conventions", conventions, x => true);

The key is the third parameter of the Register method, that acts as a filter to select what classes are affected by the convention (in my case I was filtering by the namespace, and that was the reason that the saga data was not beign persisted correctly).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Configuring Rebus sagas with UnitOfWork

From Dev

Configuring Rebus sagas with UnitOfWork

From Dev

Testing Sagas in Rebus

From Dev

Gradle naming conventions: when to use 'myProj' and when ':myProj'?

From Dev

Gradle naming conventions: when to use 'myProj' and when ':myProj'?

From Dev

Rebus and RabbitMQ - Use multiple independent instances of Rebus?

From Dev

Ember custom conventions

From Dev

Persisting custom enum values in ORMLite

From Dev

Custom Resolution not Persisting Across Reboots

From Dev

When to use "$and" operator in mongodb?

From Dev

when to use BSON in mongodb?

From Dev

When to use "$and" operator in mongodb?

From Dev

When to use a Custom CursorLoader?

From Java

Custom HTTP headers : naming conventions

From Dev

Overwritten field when persisting with JPA

From Dev

scope not persisting when changing views

From Dev

Value not persisting when using didSelectRowAtIndexPath

From Dev

Object is not persisting on save mongodb spring data java

From Dev

Laravel [5.2.21] Custom Auth Guard not persisting

From Dev

Why is this custom identity user context not persisting in MVC?

From Dev

Umbraco Grid custom editor not persisting config to the Model

From Dev

When to use embedded documents MongoDB

From Dev

when use a Custom View? - Android

From Dev

use custom mongoDB server instead of mongolab

From Dev

Set username for rebus to use to connect to messagebus

From Dev

No MessageContext available when using Autofac together with Rebus

From Dev

No MessageContext available when using Autofac together with Rebus

From Dev

Fluent NHibernate Custom Access Strategy Naming Conventions

From Dev

What are recommended conventions for proper custom systemd service?

Related Related

HotTag

Archive