Created
July 14, 2019 11:30
-
-
Save ayende/e85383ac39a7005956357636ce340a03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
var settings = new Settings(); | |
Configuration.Bind(settings); | |
var store = new DocumentStore | |
{ | |
Urls = settings.Urls, | |
Database = settings.DatabaseName, | |
Certificate = new X509Certificate2( settings.CertPath, settings.CertPass) | |
}; | |
store.Initialize(); | |
services.AddSingleton<IDocumentStore>(store); | |
services.AddScoped<IAsyncDocumentSession>(serviceProvider => | |
{ | |
return serviceProvider | |
.GetService<IDocumentStore>() | |
.OpenAsyncSession(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment