Search code examples
entity-framework-coremasstransitsagaautomatonymous

When using Automatonymous Statemachine and EF Core to store the state can I combine the state and my entities in one DbContext


I was wondering what the best practices are surrounding using EF Core, the saga state Db and your application DB, and whether you should or should not combine your saga state with your entity in the same table in the database, or even have your saga state in the same database.


Solution

  • Yes, of course you can put other entities in the same DbContext as your saga state. The only thing special about the SagaClassMap<T> is some of the base initialization, and the SagaDbContext only has a couple of helper methods.