23 lines
838 B
C#
23 lines
838 B
C#
using System.Data;
|
|
using Dapper;
|
|
|
|
namespace PlotLine.Data;
|
|
|
|
public sealed record DeploymentDatabaseHealth(string DatabaseName, bool LedgerReady, bool RuntimeRestricted = true);
|
|
|
|
public interface IDeploymentHealthRepository
|
|
{
|
|
Task<DeploymentDatabaseHealth> ReadAsync(CancellationToken cancellationToken);
|
|
}
|
|
|
|
public sealed class DeploymentHealthRepository(ISqlConnectionFactory connections) : IDeploymentHealthRepository
|
|
{
|
|
public async Task<DeploymentDatabaseHealth> ReadAsync(CancellationToken cancellationToken)
|
|
{
|
|
using var connection=connections.CreateConnection();
|
|
return await connection.QuerySingleAsync<DeploymentDatabaseHealth>(new CommandDefinition(
|
|
"dbo.Deployment_Health",commandType:CommandType.StoredProcedure,
|
|
cancellationToken:cancellationToken,commandTimeout:5));
|
|
}
|
|
}
|