DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
DotNetDupe::Extensions::DependencyInjection Namespace Reference

Classes

class  IServiceCollection
 Specifies the contract for a collection of service descriptors. More...
class  IServiceScope
 Controls the lifetime of a scoped service. More...
class  IServiceScopeFactory
 Defines a factory interface used to create instances of IServiceScope. More...
class  ServiceCollection
 Default implementation of the IServiceCollection interface. More...
class  ServiceDescriptor
 Describes a service with its service type, implementation, and lifetime. More...
class  ServiceProvider
 Default IoC service provider for resolving dependencies. More...
class  ServiceScope
 Concrete implementation of IServiceScope for managing scoped lifetimes. More...
class  ServiceScopeFactory
 Concrete implementation of IServiceScopeFactory. More...

Enumerations

enum class  ServiceLifetime { Singleton , Scoped , Transient }
 Specifies the lifetime of a service in an IServiceCollection. More...

Functions

static DotNetDupe::System::SmartPointer< DotNetDupe::System::ObjectInstantiateService (ServiceProvider *pSelf, const ServiceDescriptor &descriptor)

Enumeration Type Documentation

◆ ServiceLifetime

Specifies the lifetime of a service in an IServiceCollection.

Modeled after Microsoft.Extensions.DependencyInjection.ServiceLifetime. Defines whether a registered service is created once globally (Singleton), once per child resolution scope (Scoped), or anew upon every request (Transient). [Microsoft.Extensions.DependencyInjection]

Enumerator
Singleton 

Specifies that a single instance of the service will be created.

Scoped 

Specifies that a new instance of the service will be created for each scope.

Transient 

Specifies that a new instance of the service will be created every time it is requested.

Definition at line 11 of file ServiceLifetime.h.

Function Documentation

◆ InstantiateService()

DotNetDupe::System::SmartPointer< DotNetDupe::System::Object > DotNetDupe::Extensions::DependencyInjection::InstantiateService ( ServiceProvider * pSelf,
const ServiceDescriptor & descriptor )
static

Guard: Return pre-instantiated singleton instance if available.

Invoke factory delegate with a scoped proxy if registered.

Return null if service cannot be instantiated.

Definition at line 30 of file ServiceProvider.cpp.

References DotNetDupe::Extensions::DependencyInjection::ServiceDescriptor::GetFactory(), DotNetDupe::Extensions::DependencyInjection::ServiceDescriptor::GetInstance(), InstantiateService(), and DotNetDupe::System::SmartPointer< T >::NewShared().

Referenced by InstantiateService().