Beamable SDK
Public Member Functions | Properties | List of all members
Beamable.Common.Dependencies.IDependencyProviderScope Interface Reference

The IDependencyProviderScope is a IDependencyProvider But has more access methods and lifecycle controls. More...

Inheritance diagram for Beamable.Common.Dependencies.IDependencyProviderScope:
Inheritance graph
[legend]
Collaboration diagram for Beamable.Common.Dependencies.IDependencyProviderScope:
Collaboration graph
[legend]

Public Member Functions

Promise Dispose ()
 Disposing a IDependencyProviderScope will call IBeamableDisposable.OnDispose on all inner services that implement IBeamableDisposable. Also, after the dispose method has been called, any call to IDependencyProvider.GetService will fail. After this method, the IsDisposed will be true. However, if you re-hydrate a scope using the Hydrate method, then the scope is no longer in a disposed state. More...
 
void Hydrate (IDependencyProviderScope serviceScope)
 It is possible to "un-dispose" a scope. Hydrating a scope from another scope copies all of the services from the other scope, and uses the other scope's service descriptors to create new services. Any children will be re-hydrated and their original configuration methods will be re-fire. After this method, the IsDisposed will be false. More...
 
- Public Member Functions inherited from Beamable.Common.Dependencies.IDependencyProvider
bool CanBuildService (Type t)
 Returns true if the given service is registered in the provider. If you make a call to GetService<T> for a service that doesn't exist, you'll get an exception. More...
 
object GetService (Type t)
 Finds an instance of a service given the type parameter. All services are lazily initialized, so its possible that if is the first time the type of service has been requested, this call could allocate a new instance of the service. More...
 
GetService< T > ()
 Finds an instance of a service given the type parameter. All services are lazily initialized, so its possible that if is the first time the type of service has been requested, this call could allocate a new instance of the service. More...
 
bool CanBuildService< T > ()
 Returns true if the given service is registered in the provider. If you make a call to GetService<T> for a service that doesn't exist, you'll get an exception. More...
 
IDependencyProviderScope Fork (Action< IDependencyBuilder > configure=null)
 Create a new IDependencyProviderScope, using the current instance as a parent. Any service that was registered as a Scoped service will be re-created in the new provider. Any service that was registered as a Singleton will use the instance from the parent provider. If the parent provider has IDependencyProviderScope.Dispose called, then the child provider will also be disposed. More...
 

Properties

IDependencyProviderScope Parent [get]
 Using the IDependencyProvider.Fork method allows you to create hierarchical IDependencyProviderScope. If this scope has a parent, this will point to it, or be null.
 
IEnumerable< IDependencyProviderScopeChildren [get]
 Using the IDependencyProvider.Fork method allows you to create hierarchical IDependencyProviderScope. If this scope has any children, this enumeration shows them, or it will be empty.
 
bool IsDisposed [get]
 By default, returns false. Returns true after Dispose completed. If Hydrate is run, then this returns false again.
 
IEnumerable< ServiceDescriptorTransientServices [get]
 An enumerable set of the ServiceDescriptors that are attached to this provider as transient
 
IEnumerable< ServiceDescriptorScopedServices [get]
 An enumerable set of the ServiceDescriptors that are attached to this provider as scoped
 
IEnumerable< ServiceDescriptorSingletonServices [get]
 An enumerable set of the ServiceDescriptors that are attached to this provider as singleton
 

Detailed Description

The IDependencyProviderScope is a IDependencyProvider But has more access methods and lifecycle controls.

Member Function Documentation

◆ Dispose()

Promise Beamable.Common.Dependencies.IDependencyProviderScope.Dispose ( )

Disposing a IDependencyProviderScope will call IBeamableDisposable.OnDispose on all inner services that implement IBeamableDisposable. Also, after the dispose method has been called, any call to IDependencyProvider.GetService will fail. After this method, the IsDisposed will be true. However, if you re-hydrate a scope using the Hydrate method, then the scope is no longer in a disposed state.

Returns
A promise capturing when the disposal will complete.

Implemented in Beamable.Common.Dependencies.DependencyProvider.

◆ Hydrate()

void Beamable.Common.Dependencies.IDependencyProviderScope.Hydrate ( IDependencyProviderScope  serviceScope)

It is possible to "un-dispose" a scope. Hydrating a scope from another scope copies all of the services from the other scope, and uses the other scope's service descriptors to create new services. Any children will be re-hydrated and their original configuration methods will be re-fire. After this method, the IsDisposed will be false.

This method can be useful to re-use an instance of a IDependencyProviderScope that had been disposed.

Parameters
serviceScopeThe scope to get life from.

Implemented in Beamable.Common.Dependencies.DependencyProvider.


The documentation for this interface was generated from the following file: