Event stores
By default, EventFlow uses an in-memory event store. However, EventFlow provides support for several alternatives.
- In-memory (for testing)
- Microsoft SQL Server
- MongoDB
- Redis
- Files (for testing)
In-memory
Attention
The in-memory event store should not be used for production environments, only for testing purposes.
Using the in-memory event store is easy as it's enabled by default, so there is no need to do anything.
MSSQL event store
See MSSQL setup for details on how to get started using Microsoft SQL Server in EventFlow.
To configure EventFlow to use MSSQL as the event store, simply add the UseMssqlEventStore()
method as shown here.
1 2 3 4 5 6 7 |
|
Create and migrate required MSSQL databases
Before you can use the MSSQL event store, the required database and tables must be created. The database specified in your MSSQL connection will not be automatically created; you have to do this yourself.
To make EventFlow create the required tables, execute the following code.
1 2 3 4 |
|
You should do this either on application start or preferably upon application install or update, e.g., when the website is installed.
Attention
If you utilize user permissions in your application, you need to grant the event writer access to the user-defined table type eventdatamodel_list_type
. EventFlow uses this type to pass entire batches of events to the database.
PostgreSQL event store
See PostgreSQL setup for details on how to get started using PostgreSQL in EventFlow.
To configure EventFlow to use PostgreSQL as the event store, simply add the UsePostgreSqlEventStore()
method as shown here.
1 2 3 4 5 6 7 |
|
MongoDB
See MongoDB setup for details on how to get started using MongoDB in EventFlow.
To configure EventFlow to use MongoDB as the event store, simply add the UseMongoDbEventStore()
method as shown here.
1 2 3 4 5 6 7 |
|
Redis
See Redis setup for details on how to get started using Redis and EventFlow. Ensure that your database is persistent.
To configure EventFlow to use Redis as the event store, simply add the UseRedisEventStore()
method as shown in the example below.
1 2 3 4 5 |
|
Files
Attention
The Files event store should not be used for production environments, only for testing purposes.
The file-based event store is useful if you have a set of events that represent a certain scenario and would like to create a test that verifies that the domain handles it correctly.
To use the file-based event store, simply provide an implementation of IFilesEventStoreConfiguration
to the .UseFilesEventPersistence(...)
method.
1 2 3 4 5 6 7 8 9 10 |
|