اقرأ باللغة الإنجليزية

مشاركة عبر


NamedServiceCollectionExtensions Class

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Extensions for adding named services to INamedServiceProvider<TService>.

C#
public static class NamedServiceCollectionExtensions
Inheritance
NamedServiceCollectionExtensions

Methods

AddNamedSingleton<TService,TImplementation>(IServiceCollection, String)

Adds a singleton named service of the type specific in TService to the specified IServiceCollection.

AddNamedSingleton<TService>(IServiceCollection, String, Func<IServiceProvider,TService>)

Adds a singleton named service of the type specific in TService to the specified IServiceCollection.

AddNamedSingleton<TService>(IServiceCollection, String)

Adds a singleton named service of the type specific in TService to the specified IServiceCollection.

AddNamedTransient<TService>(IServiceCollection, String, Func<IServiceProvider,TService>)

Adds a transient named service of the type specific in TService to the specified IServiceCollection.

AddNamedTransient<TService>(IServiceCollection, String)

Adds a transient named service of the type specific in TService to the specified IServiceCollection.

Applies to

منتج الإصدارات
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)