I have a long set of services that check data, and all under the interface "IDataCheck".
IDataChecks is an empty interface with one method "runCheckAsync"
In a commandline app I do:
IEnumerable<IDataCheck>? services = _serviceProvider.GetServices<IDataCheck>();
foreach (IDataCheck? s in services)
{
DataCheckResult result = await s.RunCheckAsync();
// all kinds of stuff with the result such as proposing to autofix
}
I now want to also present the results of these checks in asp.net core healtchecks using also the healthcheck ui, ref:
- https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-6.0
- https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks
I do not want to create manually a healthcheck per data check because otherwise the usefulness of having an interface is gone
I also do not want to create one healthcheck only otherwise it will produce a long list of results all in one text only column in the ui since it does not support any formatting.