EventFlow icon indicating copy to clipboard operation
EventFlow copied to clipboard

Different MsSql Database for Read Models and Events

Open dotfelixb opened this issue 8 years ago • 4 comments

Any implementation of how to use a different database MsSql Database for events and another for read moeel, command/query segregation

dotfelixb avatar Jan 06 '18 11:01 dotfelixb

It isn't possible to do easy. You'll have to do some IoC configuration to pass a different instance of the MSSQL connection to read model updaters and readers.

rasmus avatar Jan 07 '18 08:01 rasmus

This limitation stems from the fact that the database is configured globally and not per UseEventStore()/UseReadModelStore() call. And to say frankly it's kinda pain in the butt.

Currently IMsSqlConnection, IMsSqlConnectionFactory etc. are registered directly in the container using ConfigureMsSql(). Instead, UseMssqlEventStore() (or maybe an overload of that method?) should accept IMsSqlConfiguration directly and use that IMsSqlConfiguration to instantiate MsSqlEventPersistence itself, instead of MsSqlEventPersistence using container to request IMsSqlConnection. The same goes for UseMssqlReadModel().

If I find the time, I'll try to put together something like this next week.

BTW, the same problem occurs in SQLite and probably other DB providers.

Yaevh avatar Jun 16 '21 23:06 Yaevh

Something that needs to be investigated for 1.0 for certain

rasmus avatar Jun 17 '21 05:06 rasmus

Done as done as part of 1.0 release

https://github.com/eventflow/EventFlow/blob/develop-v1/MIGRATION_GUIDE.md#notable-new-features-in-1x

rasmus avatar Mar 03 '22 08:03 rasmus