NamedServiceCollectionExtensions.AddNamedTransient Method
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.
Overloads
AddNamedTransient<TService>(IServiceCollection, String) |
Adds a transient named service of the type specific in |
AddNamedTransient<TService>(IServiceCollection, String, Func<IServiceProvider,TService>) |
Adds a transient named service of the type specific in |
AddNamedTransient<TService>(IServiceCollection, String)
Adds a transient named service of the type specific in TService
to the
specified IServiceCollection.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddNamedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ serviceCollection, System::String ^ name);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddNamedTransient<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, string name) where TService : class;
static member AddNamedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddNamedTransient(Of TService As Class) (serviceCollection As IServiceCollection, name As String) As IServiceCollection
Type Parameters
- TService
The type of the service to add.
Parameters
- serviceCollection
- IServiceCollection
The IServiceCollection to add the service to.
- name
- String
The name of the service.
Returns
A reference to this instance after the operation has completed.
Applies to
AddNamedTransient<TService>(IServiceCollection, String, Func<IServiceProvider,TService>)
Adds a transient named service of the type specific in TService
to the
specified IServiceCollection.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddNamedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ serviceCollection, System::String ^ name, Func<IServiceProvider ^, TService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddNamedTransient<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, string name, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member AddNamedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddNamedTransient(Of TService As Class) (serviceCollection As IServiceCollection, name As String, implementationFactory As Func(Of IServiceProvider, TService)) As IServiceCollection
Type Parameters
- TService
The type of the service to add.
Parameters
- serviceCollection
- IServiceCollection
The IServiceCollection to add the service to.
- name
- String
The name of the service.
- implementationFactory
- Func<IServiceProvider,TService>
The factory that creates the service.
Returns
A reference to this instance after the operation has completed.
Applies to
.NET