Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 581 Bytes

StoreInitialization.md

File metadata and controls

16 lines (12 loc) · 581 Bytes

How to programmatically initialize event store?

Sometimes it's handy to programmatically initialize event store. Do do this you can resolve IEventStoreInitializer<TAggregate, TKey> from DI service provider and call EnsureCreatedAsync().

For example to initialize event store when ASP.NET Core application is started:

public void Configure(IApplicationBuilder app,
    IWebHostEnvironment env,
    IEventStoreInitializer<GiftCard, Guid> eventStoreInitializer)
{
    eventStoreInitializer.EnsureCreatedAsync().Wait();

    // configure http request pipelines
}