public PostgresqlFhirDataStore( PostgresqlDataStoreConfiguration configuration, ILogger <SchemaInitializer> logger) { _configuration = configuration; _logger = logger; }
public PostgresqlFhirDatastoreContext CreateDbContext(string[] args) { var conf = new PostgresqlDataStoreConfiguration(); conf.ConnectionString = Environment.GetEnvironmentVariable("Postgresql:ConnectionString"); return(new PostgresqlFhirDatastoreContext(conf)); }
public static IFhirServerBuilder AddExperimentalPostgresql(this IFhirServerBuilder fhirServerBuilder, Action <PostgresqlDataStoreConfiguration> configureAction = null) { EnsureArg.IsNotNull(fhirServerBuilder, nameof(fhirServerBuilder)); IServiceCollection services = fhirServerBuilder.Services; services.Add(provider => { var config = new PostgresqlDataStoreConfiguration(); provider.GetService <IConfiguration>().GetSection("Postgresql").Bind(config); configureAction?.Invoke(config); return(config); }) .Singleton() .AsSelf(); services.Add <PostgresqlFhirDatastoreContext>() .Transient() .AsSelf(); services.Add <SchemaInitializer>() .Singleton() .AsService <IStartable>(); services.Add <PostgresqlFhirDataStore>() .Scoped() .AsSelf() .AsImplementedInterfaces(); services.Add <PostgresqlFhirOperationDataStore>() .Scoped() .AsSelf() .AsImplementedInterfaces(); services.Add <PostgresqlSearchService>() .Scoped() .AsSelf() .AsImplementedInterfaces(); services .AddHealthChecks() .AddCheck <PostgresqlHealthCheck>(nameof(PostgresqlHealthCheck)); // This is only needed while adding in the ConfigureServices call in the E2E TestServer scenario // During normal usage, the controller should be automatically discovered. // services.AddMvc().AddApplicationPart(typeof(SchemaController).Assembly); return(fhirServerBuilder); }
public PostgresqlFhirDatastoreContext(PostgresqlDataStoreConfiguration configuration) { _configuration = configuration; }