HealthChecksBuilderAddCheckExtensions.AddCheck 方法

定义

重载

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>)

添加具有指定名称和实现的新运行状况检查。

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

添加具有指定名称和实现的新运行状况检查。

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>)

添加具有指定名称和实现的新运行状况检查。

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

添加具有指定名称和实现的新运行状况检查。

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

添加具有指定名称和实现的新运行状况检查。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ AddCheck(Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ builder, System::String ^ name, Microsoft::Extensions::Diagnostics::HealthChecks::IHealthCheck ^ instance, Nullable<Microsoft::Extensions::Diagnostics::HealthChecks::HealthStatus> failureStatus, System::Collections::Generic::IEnumerable<System::String ^> ^ tags);
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable<string> tags);
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder
<Extension()>
Public Function AddCheck (builder As IHealthChecksBuilder, name As String, instance As IHealthCheck, failureStatus As Nullable(Of HealthStatus), tags As IEnumerable(Of String)) As IHealthChecksBuilder

参数

name
String

运行状况检查的名称。

instance
IHealthCheck

一个 IHealthCheck 实例。

failureStatus
Nullable<HealthStatus>

在运行状况检查报告失败时应报告的 HealthStatus。 如果提供的值为 null,则将报告 Unhealthy

tags
IEnumerable<String>

可用于筛选运行状况检查的标记的列表。

返回

IHealthChecksBuilder

适用于

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

添加具有指定名称和实现的新运行状况检查。

public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = default, TimeSpan? timeout = default);
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> * Nullable<TimeSpan> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder
<Extension()>
Public Function AddCheck (builder As IHealthChecksBuilder, name As String, instance As IHealthCheck, Optional failureStatus As Nullable(Of HealthStatus) = Nothing, Optional tags As IEnumerable(Of String) = Nothing, Optional timeout As Nullable(Of TimeSpan) = Nothing) As IHealthChecksBuilder

参数

name
String

运行状况检查的名称。

instance
IHealthCheck

一个 IHealthCheck 实例。

failureStatus
Nullable<HealthStatus>

在运行状况检查报告失败时应报告的 HealthStatus。 如果提供的值为 null,则将报告 Unhealthy

tags
IEnumerable<String>

可用于筛选运行状况检查的标记的列表。

timeout
Nullable<TimeSpan>

表示检查超时的可选 TimeSpan

返回

IHealthChecksBuilder

适用于

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

添加具有指定名称和实现的新运行状况检查。

public:
generic <typename T>
 where T : class, Microsoft::Extensions::Diagnostics::HealthChecks::IHealthCheck[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ AddCheck(Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ builder, System::String ^ name, Nullable<Microsoft::Extensions::Diagnostics::HealthChecks::HealthStatus> failureStatus, System::Collections::Generic::IEnumerable<System::String ^> ^ tags);
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck<T> (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable<string> tags) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck;
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder (requires 'T : null and 'T :> Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck)
<Extension()>
Public Function AddCheck(Of T As {Class, IHealthCheck}) (builder As IHealthChecksBuilder, name As String, failureStatus As Nullable(Of HealthStatus), tags As IEnumerable(Of String)) As IHealthChecksBuilder

类型参数

T

运行状况检查实现类型。

参数

name
String

运行状况检查的名称。

failureStatus
Nullable<HealthStatus>

在运行状况检查报告失败时应报告的 HealthStatus。 如果提供的值为 null,则将报告 Unhealthy

tags
IEnumerable<String>

可用于筛选运行状况检查的标记的列表。

返回

IHealthChecksBuilder

注解

此方法将在需要时使用 GetServiceOrCreateInstance<T>(IServiceProvider) 创建运行状况检查实例。 如果在具有任何生存期的依赖项注入容器中注册了 类型的 T 服务,则将使用该服务。 否则,将构造类型 T 为 的实例,以便从依赖项注入容器访问服务。

适用于

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

添加具有指定名称和实现的新运行状况检查。

public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck<T> (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = default, TimeSpan? timeout = default) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck;
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> * Nullable<TimeSpan> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder (requires 'T : null and 'T :> Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck)
<Extension()>
Public Function AddCheck(Of T As {Class, IHealthCheck}) (builder As IHealthChecksBuilder, name As String, Optional failureStatus As Nullable(Of HealthStatus) = Nothing, Optional tags As IEnumerable(Of String) = Nothing, Optional timeout As Nullable(Of TimeSpan) = Nothing) As IHealthChecksBuilder

类型参数

T

运行状况检查实现类型。

参数

name
String

运行状况检查的名称。

failureStatus
Nullable<HealthStatus>

在运行状况检查报告失败时应报告的 HealthStatus。 如果提供的值为 null,则将报告 Unhealthy

tags
IEnumerable<String>

可用于筛选运行状况检查的标记的列表。

timeout
Nullable<TimeSpan>

表示检查超时的可选 TimeSpan

返回

IHealthChecksBuilder

注解

此方法将在需要时使用 GetServiceOrCreateInstance<T>(IServiceProvider) 创建运行状况检查实例。 如果在具有任何生存期的依赖项注入容器中注册了 类型的 T 服务,则将使用该服务。 否则,将构造类型 T 为 的实例,以便从依赖项注入容器访问服务。

适用于