diff --git a/AspNetCore.Diagnostics.HealthChecks.sln b/AspNetCore.Diagnostics.HealthChecks.sln index 56d827accc..53cb2a8884 100644 --- a/AspNetCore.Diagnostics.HealthChecks.sln +++ b/AspNetCore.Diagnostics.HealthChecks.sln @@ -310,6 +310,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HealthChecks.Milvus", "src\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HealthChecks.Milvus.Tests", "test\HealthChecks.Milvus.Tests\HealthChecks.Milvus.Tests.csproj", "{D49CF52C-9D21-4D98-8A15-A2B259E9C003}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HealthChecks.MongoDb.v3", "src\HealthChecks.MongoDb.v3\HealthChecks.MongoDb.v3.csproj", "{DF23B881-B607-9ACE-051E-6463E677E675}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HealthChecks.MongoDb.v3.Tests", "test\HealthChecks.MongoDb.v3.Tests\HealthChecks.MongoDb.v3.Tests.csproj", "{465DB8CE-3D18-4191-8692-BC1C8BED491C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -868,6 +872,14 @@ Global {D49CF52C-9D21-4D98-8A15-A2B259E9C003}.Debug|Any CPU.Build.0 = Debug|Any CPU {D49CF52C-9D21-4D98-8A15-A2B259E9C003}.Release|Any CPU.ActiveCfg = Release|Any CPU {D49CF52C-9D21-4D98-8A15-A2B259E9C003}.Release|Any CPU.Build.0 = Release|Any CPU + {DF23B881-B607-9ACE-051E-6463E677E675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF23B881-B607-9ACE-051E-6463E677E675}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF23B881-B607-9ACE-051E-6463E677E675}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF23B881-B607-9ACE-051E-6463E677E675}.Release|Any CPU.Build.0 = Release|Any CPU + {465DB8CE-3D18-4191-8692-BC1C8BED491C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {465DB8CE-3D18-4191-8692-BC1C8BED491C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {465DB8CE-3D18-4191-8692-BC1C8BED491C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {465DB8CE-3D18-4191-8692-BC1C8BED491C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1011,6 +1023,8 @@ Global {3B812989-2C4E-4FCE-B3A0-EF9C00A9B3A5} = {FF4414C2-8863-4ADA-8A1D-4B9F25C361FE} {17913EAF-3B12-495B-80EA-9EB975FBE6BA} = {2A3FD988-2BB8-43CF-B3A2-B70E648259D4} {D49CF52C-9D21-4D98-8A15-A2B259E9C003} = {FF4414C2-8863-4ADA-8A1D-4B9F25C361FE} + {DF23B881-B607-9ACE-051E-6463E677E675} = {2A3FD988-2BB8-43CF-B3A2-B70E648259D4} + {465DB8CE-3D18-4191-8692-BC1C8BED491C} = {FF4414C2-8863-4ADA-8A1D-4B9F25C361FE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2B8C62A1-11B6-469F-874C-A02443256568} diff --git a/Directory.Build.props b/Directory.Build.props index a293c172de..8a8f8f58e5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -10,7 +10,7 @@ true true enable - $(NoWarn);1591;IDISP013;AD0001; + $(NoWarn);1591;IDISP013;AD0001;NU1901;NU1902;NU1903; true diff --git a/src/CallerArgumentExpressionAttribute.cs b/src/CallerArgumentExpressionAttribute.cs index a35295c686..9e7527a2c5 100644 --- a/src/CallerArgumentExpressionAttribute.cs +++ b/src/CallerArgumentExpressionAttribute.cs @@ -21,7 +21,7 @@ public CallerArgumentExpressionAttribute(string parameterName) #endif -#if NETSTANDARD2_0 +#if NETSTANDARD2_0 || NETFRAMEWORK namespace System.Diagnostics.CodeAnalysis { diff --git a/src/HealthChecks.MongoDb.v3/HealthChecks.MongoDb.v3.csproj b/src/HealthChecks.MongoDb.v3/HealthChecks.MongoDb.v3.csproj new file mode 100644 index 0000000000..1d77045286 --- /dev/null +++ b/src/HealthChecks.MongoDb.v3/HealthChecks.MongoDb.v3.csproj @@ -0,0 +1,20 @@ + + + + + $(DefaultNetCoreApp);netstandard2.1;net472 + $(PackageTags);MongoDb + HealthChecks.MongoDb is the health check package for MongoDb (version 3+). + $(HealthCheckMongoDB) + HealthChecks.MongoDb + + + + + + + + + + + diff --git a/src/HealthChecks.MongoDb/HealthChecks.MongoDb.csproj b/src/HealthChecks.MongoDb/HealthChecks.MongoDb.csproj index a81fa2f82e..772fc6303e 100644 --- a/src/HealthChecks.MongoDb/HealthChecks.MongoDb.csproj +++ b/src/HealthChecks.MongoDb/HealthChecks.MongoDb.csproj @@ -8,7 +8,7 @@ - + diff --git a/test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.approved.txt b/test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.approved.txt new file mode 100644 index 0000000000..88613ac36a --- /dev/null +++ b/test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.approved.txt @@ -0,0 +1,24 @@ +namespace HealthChecks.MongoDb +{ + public class MongoDbHealthCheck : Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck + { + public MongoDbHealthCheck(MongoDB.Driver.IMongoClient client, string? databaseName = null) { } + public MongoDbHealthCheck(MongoDB.Driver.MongoClientSettings clientSettings, string? databaseName = null) { } + public MongoDbHealthCheck(string connectionString, string? databaseName = null) { } + public System.Threading.Tasks.Task CheckHealthAsync(Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckContext context, System.Threading.CancellationToken cancellationToken = default) { } + } +} +namespace Microsoft.Extensions.DependencyInjection +{ + public static class MongoDbHealthCheckBuilderExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, MongoDB.Driver.MongoClientSettings mongoClientSettings, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongoClientFactory, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongodbConnectionStringFactory, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string mongodbConnectionString, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, MongoDB.Driver.MongoClientSettings mongoClientSettings, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongoClientFactory, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongodbConnectionStringFactory, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string mongodbConnectionString, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + } +} \ No newline at end of file diff --git a/test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.v3.Tests.csproj b/test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.v3.Tests.csproj new file mode 100644 index 0000000000..7b6589506d --- /dev/null +++ b/test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.v3.Tests.csproj @@ -0,0 +1,14 @@ + + + + HealthChecks.MongoDb.Tests + + + + + + + + + +