Table of Contents

Class ServiceExtensions

Namespace
API.CliniCore.Data
Assembly
API.CliniCore.dll

Extension methods for registering CliniCore services with Entity Framework Core.

public static class ServiceExtensions
Inheritance
ServiceExtensions
Inherited Members

Methods

AddCliniCoreWithEfCore(IServiceCollection, string)

Adds CliniCore services with SQLite/EF Core persistence. This replaces the in-memory repositories with EF Core implementations.

public static IServiceCollection AddCliniCoreWithEfCore(this IServiceCollection services, string connectionString)

Parameters

services IServiceCollection
connectionString string

Returns

IServiceCollection

InitializeDatabase(IServiceProvider, bool)

Ensures the database is created and seeds initial data if empty.

public static void InitializeDatabase(this IServiceProvider serviceProvider, bool seedData = true)

Parameters

serviceProvider IServiceProvider
seedData bool

Exceptions

InvalidOperationException

Thrown when database is locked by another process.