chore: add hrynco common library solution

- add the standalone HrynCo.Common solution and projects
- include the shared common library source and tests
- add package metadata and a repo gitignore
This commit is contained in:
Anatolii Grynchuk
2026-05-01 00:17:34 +03:00
commit 85b362e8cd
38 changed files with 1452 additions and 0 deletions
@@ -0,0 +1,9 @@
namespace HrynCo.Common.HealthChecks.Defaults;
using System.ComponentModel.DataAnnotations;
public class DbOptions
{
[Required]
public string? ConnectionString { get; set; } = null!;
}
@@ -0,0 +1,21 @@
namespace HrynCo.Common.HealthChecks.Defaults;
using HrynCo.Common.HealthChecks.Interfaces;
using Microsoft.Extensions.Diagnostics.HealthChecks;
public sealed class DbServiceHealthCheck : IServiceHealthCheck
{
private readonly IDatabaseConnectionChecker _checker;
public DbServiceHealthCheck(IDatabaseConnectionChecker checker)
{
_checker = checker;
}
public async Task<HealthCheckResult> CheckHealthAsync(CancellationToken cancellationToken)
{
return await _checker.CanConnectAsync(cancellationToken)
? HealthCheckResult.Healthy("Database reachable")
: HealthCheckResult.Unhealthy("Database unreachable");
}
}
@@ -0,0 +1,9 @@
namespace HrynCo.Common.HealthChecks.Defaults;
using System.ComponentModel.DataAnnotations;
public class SeqOptions
{
[Required]
public string? ServerUrl { get; set; }
}