-
Notifications
You must be signed in to change notification settings - Fork 70
MongoDb
ZhangYang edited this page Sep 7, 2019
·
2 revisions
Integrating MongoDb is quite simple, install nuget MongoDB.Driver and EventFlow.MongoDB.
The registration as below, ideally the connection string should come from Configuration, but these is no chance to inject IConfiguration in this design, I'd suggest EventFlow can add IMongoClientProvider to config connection string
public class MongoDbReadModelModule : IModule
{
public void Register(IEventFlowOptions eventFlowOptions)
{
// TODO: read form config
var client = new MongoClient("mongodb://localhost:27017");
eventFlowOptions
.AddDefaults(typeof(MongoDbReadModelModule).Assembly)
.ConfigureMongoDb(client, "restairline")
.UseMongoDbReadModel<MongoDbBookingReadModel>();
}
}
For testing we used Mongo2Go, please take a look at RestAirline.ReadModel.MongoDB.Tests How tests work.
-
Getting started
-
ASP.NET Core
-
Docker & Docker-compose
-
Hypermedia API
-
EntityFramework ReadModel
-
MongoDb ReadModel
-
Elasticseach ReadModel
-
DDD
-
Domain