ServiceCollectionServiceExtensions.AddSingleton Metodo

Definizione

Overload

AddSingleton(IServiceCollection, Type)

Aggiunge un servizio singleton del tipo specificato in serviceType all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

Aggiunge un servizio singleton del tipo specificato in serviceType con una factory specificata in implementationFactory all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type, Object)

Aggiunge un servizio singleton del tipo specificato in serviceType con un'istanza specificata in implementationInstance all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType with an instance specified in implementationInstance to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type, Type)

Aggiunge un servizio singleton del tipo specificato in serviceType con un'implementazione del tipo specificato in implementationType all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Aggiunge un servizio singleton del tipo specificato in TService con un tipo di implementazione specificato in TImplementation usando la factory specificata in implementationFactory all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton<TService,TImplementation>(IServiceCollection)

Aggiunge un servizio singleton del tipo specificato in TService con un tipo di implementazione specificato in TImplementation all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

AddSingleton<TService>(IServiceCollection)

Aggiunge un servizio singleton del tipo specificato in TService all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService to the specified IServiceCollection.

AddSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

Aggiunge un servizio singleton del tipo specificato in TService con una factory specificata in implementationFactory all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton<TService>(IServiceCollection, TService)

Aggiunge un servizio singleton del tipo specificato in TService con un'istanza specificata in implementationInstance all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with an instance specified in implementationInstance to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type)

Aggiunge un servizio singleton del tipo specificato in serviceType all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType to the specified IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType);
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddSingleton (services As IServiceCollection, serviceType As Type) As IServiceCollection

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

serviceType
Type

Tipo di servizio da registrare e implementazione da usare.The type of the service to register and the implementation to use.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

Aggiunge un servizio singleton del tipo specificato in serviceType con una factory specificata in implementationFactory all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, Func<IServiceProvider,object> implementationFactory);
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Func<IServiceProvider, obj> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddSingleton (services As IServiceCollection, serviceType As Type, implementationFactory As Func(Of IServiceProvider, Object)) As IServiceCollection

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

serviceType
Type

Tipo di servizio da registrare.The type of the service to register.

implementationFactory
Func<IServiceProvider,Object>

Factory che crea il servizio.The factory that creates the service.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton(IServiceCollection, Type, Object)

Aggiunge un servizio singleton del tipo specificato in serviceType con un'istanza specificata in implementationInstance all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType with an instance specified in implementationInstance to the specified IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, System::Object ^ implementationInstance);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, object implementationInstance);
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddSingleton (services As IServiceCollection, serviceType As Type, implementationInstance As Object) As IServiceCollection

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

serviceType
Type

Tipo di servizio da registrare.The type of the service to register.

implementationInstance
Object

Istanza del servizio.The instance of the service.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton(IServiceCollection, Type, Type)

Aggiunge un servizio singleton del tipo specificato in serviceType con un'implementazione del tipo specificato in implementationType all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, Type ^ implementationType);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, Type implementationType);
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Type -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddSingleton (services As IServiceCollection, serviceType As Type, implementationType As Type) As IServiceCollection

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

serviceType
Type

Tipo di servizio da registrare.The type of the service to register.

implementationType
Type

Tipo di implementazione del servizio.The implementation type of the service.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Aggiunge un servizio singleton del tipo specificato in TService con un tipo di implementazione specificato in TImplementation usando la factory specificata in implementationFactory all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TImplementation> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TImplementation> implementationFactory) where TService : class where TImplementation : class, TService;
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, #'Service> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingleton(Of TService As Class, TImplementation As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TImplementation)) As IServiceCollection

Parametri di tipo

TService

Tipo del servizio da aggiungere.The type of the service to add.

TImplementation

Tipo di implementazione da utilizzare.The type of the implementation to use.

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

implementationFactory
Func<IServiceProvider,TImplementation>

Factory che crea il servizio.The factory that creates the service.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton<TService,TImplementation>(IServiceCollection)

Aggiunge un servizio singleton del tipo specificato in TService con un tipo di implementazione specificato in TImplementation all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class where TImplementation : class, TService;
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingleton(Of TService As Class, TImplementation As Class) (services As IServiceCollection) As IServiceCollection

Parametri di tipo

TService

Tipo del servizio da aggiungere.The type of the service to add.

TImplementation

Tipo di implementazione da utilizzare.The type of the implementation to use.

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton<TService>(IServiceCollection)

Aggiunge un servizio singleton del tipo specificato in TService all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService to the specified IServiceCollection.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class;
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingleton(Of TService As Class) (services As IServiceCollection) As IServiceCollection

Parametri di tipo

TService

Tipo del servizio da aggiungere.The type of the service to add.

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

Aggiunge un servizio singleton del tipo specificato in TService con una factory specificata in implementationFactory all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingleton(Of TService As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TService)) As IServiceCollection

Parametri di tipo

TService

Tipo del servizio da aggiungere.The type of the service to add.

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

implementationFactory
Func<IServiceProvider,TService>

Factory che crea il servizio.The factory that creates the service.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

AddSingleton<TService>(IServiceCollection, TService)

Aggiunge un servizio singleton del tipo specificato in TService con un'istanza specificata in implementationInstance all'oggetto IServiceCollection specificato.Adds a singleton service of the type specified in TService with an instance specified in implementationInstance to the specified IServiceCollection.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, TService implementationInstance);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, TService implementationInstance) where TService : class;
static member AddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * 'Service -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingleton(Of TService As Class) (services As IServiceCollection, implementationInstance As TService) As IServiceCollection

Parametri di tipo

TService

Parametri

services
IServiceCollection

Oggetto IServiceCollection a cui aggiungere il servizio.The IServiceCollection to add the service to.

implementationInstance
TService

Istanza del servizio.The instance of the service.

Restituisce

Riferimento a questa istanza dopo il completamento dell'operazione.A reference to this instance after the operation has completed.

Vedi anche

Si applica a