55 using System . IO ;
66 using System . Reflection ;
77 using Common ;
8+ using EventStore . Client ;
89 using Lamar ;
10+ using Microsoft . Extensions . Configuration ;
911 using Microsoft . Extensions . DependencyInjection ;
1012 using Microsoft . Extensions . Diagnostics . HealthChecks ;
1113 using Microsoft . OpenApi . Models ;
@@ -19,11 +21,14 @@ public class MiddlewareRegistry :ServiceRegistry
1921 {
2022 public MiddlewareRegistry ( )
2123 {
22- this . AddHealthChecks ( ) . AddEventStore ( Startup . EventStoreClientSettings ,
23- userCredentials : Startup . EventStoreClientSettings . DefaultCredentials ,
24- name : "Eventstore" ,
25- failureStatus : HealthStatus . Unhealthy ,
26- tags : new string [ ] { "db" , "eventstore" } ) ;
24+ String connectionString = Startup . Configuration . GetValue < String > ( "EventStoreSettings:ConnectionString" ) ;
25+ EventStoreClientSettings eventStoreSettings = EventStoreClientSettings . Create ( connectionString ) ;
26+
27+ this . AddHealthChecks ( ) . AddEventStore ( eventStoreSettings ,
28+ userCredentials : eventStoreSettings . DefaultCredentials ,
29+ name : "Eventstore" ,
30+ failureStatus : HealthStatus . Unhealthy ,
31+ tags : new string [ ] { "db" , "eventstore" } ) ;
2732
2833 this . AddSwaggerGen ( c =>
2934 {
@@ -43,8 +48,8 @@ public MiddlewareRegistry()
4348 c . ExampleFilters ( ) ;
4449
4550 //Locate the XML files being generated by ASP.NET...
46- var directory = new DirectoryInfo ( AppContext . BaseDirectory ) ;
47- var xmlFiles = directory . GetFiles ( "*.xml" ) ;
51+ DirectoryInfo directory = new DirectoryInfo ( AppContext . BaseDirectory ) ;
52+ FileInfo [ ] xmlFiles = directory . GetFiles ( "*.xml" ) ;
4853
4954 //... and tell Swagger to use those XML comments.
5055 foreach ( FileInfo fileInfo in xmlFiles )
0 commit comments