Skip to content

Instantly share code, notes, and snippets.

@ayende
Created July 14, 2019 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayende/e85383ac39a7005956357636ce340a03 to your computer and use it in GitHub Desktop.
Save ayende/e85383ac39a7005956357636ce340a03 to your computer and use it in GitHub Desktop.
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