Beamable SDK
|
The IDependencyBuilder is part of the Beamable dependency injection system. It is used to describe a set of services that will exist, but the builder never actually creates any service instance. More...
Public Member Functions | |
IDependencyBuilder | AddTransient< TInterface, TImpl > (Func< IDependencyProvider, TInterface > factory) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService. More... | |
IDependencyBuilder | AddTransient< TInterface, TImpl > (Func< TInterface > factory) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService. More... | |
IDependencyBuilder | AddTransient< TInterface, TImpl > () |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService. More... | |
IDependencyBuilder | AddTransient< T > (Func< IDependencyProvider, T > factory) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService. More... | |
IDependencyBuilder | AddTransient< T > (Func< T > factory) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService. More... | |
IDependencyBuilder | AddTransient< T > () |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService. More... | |
IDependencyBuilder | AddScoped< TInterface, TImpl > (Func< IDependencyProvider, TInterface > factory) |
Add a scoped service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddScoped< TInterface, TImpl > (Func< TInterface > factory) |
Add a transient service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddScoped< TInterface, TImpl > (TInterface service) |
Add a transient service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddScoped< TInterface, TImpl > () |
Add a transient service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddScoped< T > (Func< IDependencyProvider, T > factory) |
Add a transient service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddScoped< T > (Func< T > factory) |
Add a transient service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddScoped< T > (T service) |
Add a transient service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddScoped< T > () |
Add a transient service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< TInterface, TImpl > (Func< IDependencyProvider, TInterface > factory) |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< TInterface, TImpl > (Func< TInterface > factory) |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< TInterface, TImpl > (TInterface service) |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< TInterface, TImpl > () |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< T > (Func< IDependencyProvider, T > factory) |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< T > (Func< T > factory) |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< T > (Type registeredType, Func< T > factory) |
Add a singleton service to the IDependencyBuilder. This overload allows for you to add batches of concrete service implementations that are tied to their concrete implementation dynamically (without knowing them at compilation-time). More... | |
IDependencyBuilder | AddSingleton< T > (T service) |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton (Type t) |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyBuilder | AddSingleton< T > () |
Add a singleton service to the IDependencyBuilder. More... | |
IDependencyProviderScope | Build () |
After you have registered all your services, use this method to finalize the builder and produce a IDependencyProvider that can be used to get services. The actual return value will be a IDependencyProviderScope which has lifecycle controls for the IDependencyProvider More... | |
IDependencyBuilder | Remove< T > () |
Removes a service of some type that was added with any of the AddTransient, AddScoped, or AddSingleton calls. It doesn't matter how the type was registered. If no service was added, then this method will throw an exception. Use RemoveIfExists<T> to avoid the exception. More... | |
IDependencyBuilder | RemoveIfExists< T > () |
Removes a service of some type that was added with any of the AddTransient, AddScoped, or AddSingleton calls. It doesn't matter how the type was registered. If no service was added, then this method is a no-op. More... | |
bool | Has< T > () |
Returns true is the given service has been registered. More... | |
IDependencyBuilder | Clone () |
Clones the IDependencyBuilder. The resulting builder will have of the same registrations that the current instance has. However, if you add any services to the original instance, or the returned instance, the addition won't affect the service registration state of the builder. More... | |
The IDependencyBuilder is part of the Beamable dependency injection system. It is used to describe a set of services that will exist, but the builder never actually creates any service instance.
You use a IDependencyBuilder to assemble a description of your service layout, and then use the IDependencyBuilder.Build method to construct a IDependencyProvider.
Before you finalize the builder, add services to the builder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< T > | ( | ) |
Add a transient service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
The instance will automatically be created by using the first available constructor of the TImpl type, and providing parameters for the constructor from the IDependencyProvider itself
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< T > | ( | Func< IDependencyProvider, T > | factory | ) |
Add a transient service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
factory | A function that takes a IDependencyProvider and produces an instance of TInterface |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< T > | ( | Func< T > | factory | ) |
Add a transient service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
factory | A function that produces an instance of TInterface |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< T > | ( | T | service | ) |
Add a transient service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
service | a value of T that will be used as the scoped instance |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< TInterface, TImpl > | ( | ) |
Add a transient service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
The instance will automatically be created by using the first available constructor of the TImpl type, and providing parameters for the constructor from the IDependencyProvider itself
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< TInterface, TImpl > | ( | Func< IDependencyProvider, TInterface > | factory | ) |
Add a scoped service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
factory | A function that takes a IDependencyProvider and produces an instance of TInterface |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< TInterface, TImpl > | ( | Func< TInterface > | factory | ) |
Add a transient service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
factory | A function that produces an instance of TInterface |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddScoped< TInterface, TImpl > | ( | TInterface | service | ) |
Add a transient service to the IDependencyBuilder.
A scoped service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. However, if you use Clone, then all calls to IDependencyProvider.GetService on the resultant IDependencyProvider will generate a new scope instance.
service | a value of TInterface that will be used as the scoped instance |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton | ( | Type | t | ) |
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
The instance will automatically be created by using the first available constructor of the TImpl type, and providing parameters for the constructor from the IDependencyProvider itself
t | The type of the service that is registered |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
The instance will automatically be created by using the first available constructor of the TImpl type, and providing parameters for the constructor from the IDependencyProvider itself
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton< T > | ( | Func< IDependencyProvider, T > | factory | ) |
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
factory | A function that takes a IDependencyProvider and produces an instance of T |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton< T > | ( | Func< T > | factory | ) |
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
factory | A function that produces an instance of T |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
service | A value instance of TInterface |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton< T > | ( | Type | registeredType, |
Func< T > | factory | ||
) |
Add a singleton service to the IDependencyBuilder. This overload allows for you to add batches of concrete service implementations that are tied to their concrete implementation dynamically (without knowing them at compilation-time).
registeredType | The service is added tied to this type. Once the services are built, use this type to retrieve it. |
factory | A function that produces an instance of registeredType . This type must inherit from T . |
T | A parent type of registeredType . |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton< TInterface, TImpl > | ( | ) |
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
The instance will automatically be created by using the first available constructor of the TImpl type, and providing parameters for the constructor from the IDependencyProvider itself
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton< TInterface, TImpl > | ( | Func< IDependencyProvider, TInterface > | factory | ) |
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
factory | A function that takes a IDependencyProvider and produces an instance of TInterface |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton< TInterface, TImpl > | ( | Func< TInterface > | factory | ) |
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
factory | A function that produces an instance of TInterface |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddSingleton< TInterface, TImpl > | ( | TInterface | service | ) |
Add a singleton service to the IDependencyBuilder.
A singleton service will be instantiated once, and the same instance will be requested from IDependencyProvider.GetService. Even if you use Clone, the one instance will be returned for all children providers.
service | A value instance of TInterface |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddTransient< T > | ( | ) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService.
The instance will automatically be created by using the first available constructor of the TImpl type, and providing parameters for the constructor from the IDependencyProvider itself
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddTransient< T > | ( | Func< IDependencyProvider, T > | factory | ) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService.
factory | A function that takes a IDependencyProvider and produces an instance of TInterface |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddTransient< T > | ( | Func< T > | factory | ) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService.
factory | A function that produces an instance of TInterface |
T | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddTransient< TInterface, TImpl > | ( | ) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService.
The instance will automatically be created by using the first available constructor of the TImpl type, and providing parameters for the constructor from the IDependencyProvider itself
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddTransient< TInterface, TImpl > | ( | Func< IDependencyProvider, TInterface > | factory | ) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService.
factory | A function that takes a IDependencyProvider and produces an instance of TInterface |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.AddTransient< TInterface, TImpl > | ( | Func< TInterface > | factory | ) |
Add a transient service to the IDependencyBuilder. A transient service will be re-instantiated everytime it is requested from IDependencyProvider.GetService.
factory | A function that produces an instance of TInterface |
TInterface | The type that is actually registered in the IDependencyBuilder. There can only be one registration for this type per IDependencyBuilder |
TImpl | The concrete type of the instance that will be returned from IDependencyProvider.GetService |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
TImpl | : | TInterface |
IDependencyProviderScope Beamable.Common.Dependencies.IDependencyBuilder.Build | ( | ) |
After you have registered all your services, use this method to finalize the builder and produce a IDependencyProvider that can be used to get services. The actual return value will be a IDependencyProviderScope which has lifecycle controls for the IDependencyProvider
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.Clone | ( | ) |
Clones the IDependencyBuilder. The resulting builder will have of the same registrations that the current instance has. However, if you add any services to the original instance, or the returned instance, the addition won't affect the service registration state of the builder.
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
bool Beamable.Common.Dependencies.IDependencyBuilder.Has< T > | ( | ) |
Returns true is the given service has been registered.
T | The type of service to check for |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.Remove< T > | ( | ) |
Removes a service of some type that was added with any of the AddTransient, AddScoped, or AddSingleton calls. It doesn't matter how the type was registered. If no service was added, then this method will throw an exception. Use RemoveIfExists<T> to avoid the exception.
T | The type of service to remove |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.
IDependencyBuilder Beamable.Common.Dependencies.IDependencyBuilder.RemoveIfExists< T > | ( | ) |
Removes a service of some type that was added with any of the AddTransient, AddScoped, or AddSingleton calls. It doesn't matter how the type was registered. If no service was added, then this method is a no-op.
T | The type of service to remove |
Implemented in Beamable.Common.Dependencies.DependencyBuilder.