1

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?

Community
  • 1
  • 1
Ricardo Rodriguez
  • 1,010
  • 11
  • 22

1 Answers1

1

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).

Ricardo Rodriguez
  • 1,010
  • 11
  • 22