Table of Contents

Class CoreServiceBootstrapper

Namespace
Core.CliniCore.Bootstrap
Assembly
Core.CliniCore.dll

Provides dependency injection registration for all core CliniCore services. This bootstrapper ensures consistent service configuration across different client applications (CLI, GUI, etc.)

public static class CoreServiceBootstrapper
Inheritance
CoreServiceBootstrapper
Inherited Members

Methods

AddCliniCoreServices(IServiceCollection)

Registers all core CliniCore services with the dependency injection container. IMPORTANT: You must also register repositories separately using either:

  • AddInMemoryRepositories() for standalone/testing
  • AddRemoteRepositories(apiBaseUrl) for API-backed persistence Call this method from your client application's startup/configuration.
public static IServiceCollection AddCliniCoreServices(this IServiceCollection services)

Parameters

services IServiceCollection

The service collection to register services with

Returns

IServiceCollection

The service collection for chaining

AddCliniCoreServicesWithCustomAuth(IServiceCollection, IAuthenticationService)

Registers core services with custom implementations. Useful for testing or when you need to override default implementations.

public static IServiceCollection AddCliniCoreServicesWithCustomAuth(this IServiceCollection services, IAuthenticationService customAuthService)

Parameters

services IServiceCollection

The service collection

customAuthService IAuthenticationService

Custom authentication service implementation

Returns

IServiceCollection

The service collection for chaining

AddCliniCoreServicesWithInMemory(IServiceCollection)

Registers all core CliniCore services WITH InMemory repositories. Use this for backwards compatibility or standalone operation.

public static IServiceCollection AddCliniCoreServicesWithInMemory(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

EnsureApiAvailableAsync(string, bool, int)

Ensures the API server is available. If localProvider is true and the API is not running, attempts to start it as an independent background process.

public static Task<bool> EnsureApiAvailableAsync(string apiBaseUrl, bool localProvider, int timeoutSeconds = 30)

Parameters

apiBaseUrl string

The base URL of the API (e.g., "http://localhost:5000")

localProvider bool

If true, will attempt to start API locally if not running

timeoutSeconds int

How long to wait for API to become healthy

Returns

Task<bool>

True if API is available, false otherwise

IsApiHealthyAsync(string)

Checks if the API is responding to health check requests. Uses dedicated /health endpoint - lightweight, no database queries. Catches expected network exceptions by type to avoid debugger breaks.

public static Task<bool> IsApiHealthyAsync(string apiBaseUrl)

Parameters

apiBaseUrl string

Returns

Task<bool>