ServiceCollectionServiceExtensions.AddScoped Метод
Определение
Перегрузки
AddScoped(IServiceCollection, Type) |
Добавляет службу с ограниченной областью типа, указанного в параметре |
AddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>) |
Добавляет службу с ограниченной областью типа, указанного в параметре |
AddScoped(IServiceCollection, Type, Type) |
Добавляет службу с ограниченной областью типа, указанного в параметре |
AddScoped<TService,TImplementation>(IServiceCollection) |
Добавляет службу с ограниченной областью типа, указанного в параметре |
AddScoped<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>) |
Добавляет службу с ограниченной областью типа, указанного в параметре |
AddScoped<TService>(IServiceCollection) |
Добавляет службу с ограниченной областью типа, указанного в параметре |
AddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>) |
Добавляет службу с ограниченной областью типа, указанного в параметре |
AddScoped(IServiceCollection, Type)
Добавляет службу с ограниченной областью типа, указанного в параметре serviceType
, в заданную коллекцию IServiceCollection.Adds a scoped service of the type specified in serviceType
to the specified IServiceCollection.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType);
static member AddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddScoped (services As IServiceCollection, serviceType As Type) As IServiceCollection
Параметры
- services
- IServiceCollection
Коллекция IServiceCollection, в которую нужно добавить службу.The IServiceCollection to add the service to.
- serviceType
- Type
Тип регистрируемой службы и используемая реализация.The type of the service to register and the implementation to use.
Возвращаемое значение
Ссылка на этот экземпляр после завершения операции.A reference to this instance after the operation has completed.
См. также раздел
Применяется к
AddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)
Добавляет службу с ограниченной областью типа, указанного в параметре serviceType
, с фабрикой, указанной в параметре implementationFactory
, в заданную коллекцию IServiceCollection.Adds a scoped 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 ^ AddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, Func<IServiceProvider,object> implementationFactory);
static member AddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Func<IServiceProvider, obj> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddScoped (services As IServiceCollection, serviceType As Type, implementationFactory As Func(Of IServiceProvider, Object)) As IServiceCollection
Параметры
- services
- IServiceCollection
Коллекция IServiceCollection, в которую нужно добавить службу.The IServiceCollection to add the service to.
- serviceType
- Type
Тип регистрируемой службы.The type of the service to register.
- implementationFactory
- Func<IServiceProvider,Object>
Фабрика, создающая службу.The factory that creates the service.
Возвращаемое значение
Ссылка на этот экземпляр после завершения операции.A reference to this instance after the operation has completed.
См. также раздел
Применяется к
AddScoped(IServiceCollection, Type, Type)
Добавляет службу с ограниченной областью типа, указанного в параметре serviceType
, с реализацией типа, указанного в параметре implementationType
, в заданную коллекцию IServiceCollection.Adds a scoped 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 ^ AddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, Type ^ implementationType);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, Type implementationType);
static member AddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Type -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddScoped (services As IServiceCollection, serviceType As Type, implementationType As Type) As IServiceCollection
Параметры
- services
- IServiceCollection
Коллекция IServiceCollection, в которую нужно добавить службу.The IServiceCollection to add the service to.
- serviceType
- Type
Тип регистрируемой службы.The type of the service to register.
- implementationType
- Type
Тип реализации службы.The implementation type of the service.
Возвращаемое значение
Ссылка на этот экземпляр после завершения операции.A reference to this instance after the operation has completed.
См. также раздел
Применяется к
AddScoped<TService,TImplementation>(IServiceCollection)
Добавляет службу с ограниченной областью типа, указанного в параметре TService
, с типом реализации, указанным в параметре TImplementation
, в заданную коллекцию IServiceCollection.Adds a scoped 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 ^ AddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class where TImplementation : class, TService;
static member AddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddScoped(Of TService As Class, TImplementation As Class) (services As IServiceCollection) As IServiceCollection
Параметры типа
- TService
Тип добавляемой службы.The type of the service to add.
- TImplementation
Тип используемой реализации.The type of the implementation to use.
Параметры
- services
- IServiceCollection
Коллекция IServiceCollection, в которую нужно добавить службу.The IServiceCollection to add the service to.
Возвращаемое значение
Ссылка на этот экземпляр после завершения операции.A reference to this instance after the operation has completed.
См. также раздел
Применяется к
AddScoped<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)
Добавляет службу с ограниченной областью типа, указанного в параметре TService
, с типом реализации, указанным в параметре TImplementation
, и фабрикой, указанной в параметре implementationFactory
, в заданную коллекцию IServiceCollection.Adds a scoped 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 ^ AddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TImplementation> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TImplementation> implementationFactory) where TService : class where TImplementation : class, TService;
static member AddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, #'Service> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddScoped(Of TService As Class, TImplementation As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TImplementation)) As IServiceCollection
Параметры типа
- TService
Тип добавляемой службы.The type of the service to add.
- TImplementation
Тип используемой реализации.The type of the implementation to use.
Параметры
- services
- IServiceCollection
Коллекция IServiceCollection, в которую нужно добавить службу.The IServiceCollection to add the service to.
- implementationFactory
- Func<IServiceProvider,TImplementation>
Фабрика, создающая службу.The factory that creates the service.
Возвращаемое значение
Ссылка на этот экземпляр после завершения операции.A reference to this instance after the operation has completed.
См. также раздел
Применяется к
AddScoped<TService>(IServiceCollection)
Добавляет службу с ограниченной областью типа, указанного в параметре TService
, в заданную коллекцию IServiceCollection.Adds a scoped 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 ^ AddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class;
static member AddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddScoped(Of TService As Class) (services As IServiceCollection) As IServiceCollection
Параметры типа
- TService
Тип добавляемой службы.The type of the service to add.
Параметры
- services
- IServiceCollection
Коллекция IServiceCollection, в которую нужно добавить службу.The IServiceCollection to add the service to.
Возвращаемое значение
Ссылка на этот экземпляр после завершения операции.A reference to this instance after the operation has completed.
См. также раздел
Применяется к
AddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>)
Добавляет службу с ограниченной областью типа, указанного в параметре TService
, с фабрикой, указанной в параметре implementationFactory
, в заданную коллекцию IServiceCollection.Adds a scoped 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 ^ AddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member AddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddScoped(Of TService As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TService)) As IServiceCollection
Параметры типа
- TService
Тип добавляемой службы.The type of the service to add.
Параметры
- services
- IServiceCollection
Коллекция IServiceCollection, в которую нужно добавить службу.The IServiceCollection to add the service to.
- implementationFactory
- Func<IServiceProvider,TService>
Фабрика, создающая службу.The factory that creates the service.
Возвращаемое значение
Ссылка на этот экземпляр после завершения операции.A reference to this instance after the operation has completed.