diff --git a/SqlData/Persistence/DependencyInjection.cs b/SqlData/Persistence/DependencyInjection.cs index f86cd87..b9376a9 100644 --- a/SqlData/Persistence/DependencyInjection.cs +++ b/SqlData/Persistence/DependencyInjection.cs @@ -86,4 +86,15 @@ public static class DependencyInjection }; } } + + public static IHealthChecksBuilder AddDatabaseHealthCheck(this IHealthChecksBuilder healthChecksBuilder, DatabaseProvider dbProvider, string connection) + { + return dbProvider switch + { + DatabaseProvider.Mysql => healthChecksBuilder.AddMySql(connection, name: "MySql"), + DatabaseProvider.Sqlite => healthChecksBuilder.AddSqlite(connection, name: "Sqlite"), + DatabaseProvider.Postgresql => healthChecksBuilder.AddNpgSql(connection, name: "PostgreSQL"), + _ => throw new ArgumentException("Unsupported database provider", Enum.GetName(dbProvider)) + }; + } } \ No newline at end of file diff --git a/SqlData/Persistence/Persistence.csproj b/SqlData/Persistence/Persistence.csproj index 5cb3dde..3008d4e 100644 --- a/SqlData/Persistence/Persistence.csproj +++ b/SqlData/Persistence/Persistence.csproj @@ -5,16 +5,20 @@ disable enable Winsomnia - 1.0.0 - 1.0.3.0 - 1.0.3.0 + 1.0.1 + 1.0.3.1 + 1.0.3.1 Mirea.Api.DataAccess.Persistence $(AssemblyName) + + + +