ServiceCollectionDescriptorExtensions.TryAddEnumerable メソッド

定義

オーバーロード

TryAddEnumerable(IServiceCollection, ServiceDescriptor)

ServiceType を同じくする既存の記述子と services にまだ存在しない実装の場合、ServiceDescriptor を追加します。Adds a ServiceDescriptor if an existing descriptor with the same ServiceType and an implementation that does not already exist in services.

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

ServiceType を同じくする既存の記述子と services にまだ存在しない実装の場合、指定の ServiceDescriptor を追加します。Adds the specified ServiceDescriptors if an existing descriptor with the same ServiceType and an implementation that does not already exist in services.

TryAddEnumerable(IServiceCollection, ServiceDescriptor)

ServiceType を同じくする既存の記述子と services にまだ存在しない実装の場合、ServiceDescriptor を追加します。Adds a ServiceDescriptor if an existing descriptor with the same ServiceType and an implementation that does not already exist in services.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddEnumerable(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ descriptor);
public static void TryAddEnumerable (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.DependencyInjection.ServiceDescriptor descriptor);
static member TryAddEnumerable : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.DependencyInjection.ServiceDescriptor -> unit
<Extension()>
Public Sub TryAddEnumerable (services As IServiceCollection, descriptor As ServiceDescriptor)

パラメーター

注釈

TryAddEnumerable(IServiceCollection, ServiceDescriptor)同じサービスの種類の複数の登録をサポートするサービスの種類のサービス実装を登録するときに使用します。Use TryAddEnumerable(IServiceCollection, ServiceDescriptor) when registering a service implementation of a service type that supports multiple registrations of the same service type. を使用する Add(IServiceCollection, ServiceDescriptor) ことはべき等ではなく、 ServiceDescriptor 2 回呼び出された場合は重複するインスタンスを追加できます。Using Add(IServiceCollection, ServiceDescriptor) is not idempotent and can add duplicate ServiceDescriptor instances if called twice. を使用する TryAddEnumerable(IServiceCollection, ServiceDescriptor) と、複数の実装の種類を登録できなくなります。Using TryAddEnumerable(IServiceCollection, ServiceDescriptor) will prevent registration of multiple implementation types.

適用対象

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

ServiceType を同じくする既存の記述子と services にまだ存在しない実装の場合、指定の ServiceDescriptor を追加します。Adds the specified ServiceDescriptors if an existing descriptor with the same ServiceType and an implementation that does not already exist in services.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddEnumerable(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Collections::Generic::IEnumerable<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^> ^ descriptors);
public static void TryAddEnumerable (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor> descriptors);
static member TryAddEnumerable : Microsoft.Extensions.DependencyInjection.IServiceCollection * seq<Microsoft.Extensions.DependencyInjection.ServiceDescriptor> -> unit
<Extension()>
Public Sub TryAddEnumerable (services As IServiceCollection, descriptors As IEnumerable(Of ServiceDescriptor))

パラメーター

注釈

TryAddEnumerable(IServiceCollection, ServiceDescriptor)同じサービスの種類の複数の登録をサポートするサービスの種類のサービス実装を登録するときに使用します。Use TryAddEnumerable(IServiceCollection, ServiceDescriptor) when registering a service implementation of a service type that supports multiple registrations of the same service type. を使用する Add(IServiceCollection, ServiceDescriptor) ことはべき等ではなく、 ServiceDescriptor 2 回呼び出された場合は重複するインスタンスを追加できます。Using Add(IServiceCollection, ServiceDescriptor) is not idempotent and can add duplicate ServiceDescriptor instances if called twice. を使用する TryAddEnumerable(IServiceCollection, ServiceDescriptor) と、複数の実装の種類を登録できなくなります。Using TryAddEnumerable(IServiceCollection, ServiceDescriptor) will prevent registration of multiple implementation types.

適用対象