Binder<TContract>
A class in Alta.LifetimeScopes, Alta.ATT.LifetimeScopes.
Fluent helper for registering a type in a VContainer container, made by container.Bind<TContract>(). Registers as a singleton by default and picks up VContainer entry point interfaces (like ITickable) by itself.
- Listed in Other Alta assemblies
- Inherits or implements
Binder - Nested types
AltaRegistrationBuilder
Constructors
| Member | What it is |
|---|---|
Binder(IContainerBuilder container) | Creates a Binder from container. |
Fields
1 private and internal field
Properties
6 private and internal properties
| Member | What it is |
|---|---|
private List<Type> BoundTypes { get; } | The contract types the result is registered as. Starts with TContract. |
private IContainerBuilder Container { get; } | The container builder this binder registers into. |
private bool HasEntryPoints { get; set; } | Set when the result or a bound type is a VContainer entry point, so the entry point dispatcher gets registered. |
private Lifetime Lifetime { get; set; } | The lifetime the registration uses. |
internal Binder<TContract> RegistrationBuilder { get; } | The builder registered with the container. It builds the final registration from this binder's settings. |
private Type ResultType { get; set; } | The concrete type resolved for the contract, set by To. |
Methods
| Member | What it is |
|---|---|
Binder<TContract> And<TAdditionalContract>() | Also registers the result under another contract type. |
Binder<TContract> AsScoped() | Registers with scoped lifetime. |
Binder<TContract> AsSingleton() | Registers with singleton lifetime (the default). |
Binder<TContract> AsTransient() | Registers with transient lifetime, a new instance each time it is resolved. |
Binder<TContract> To<TResult>() | Sets the concrete type to resolve. The overload taking an instance registers that existing object instead. |
Binder<TContract> To<TResult>(TResult instance) | Sets the concrete type to resolve. The overload taking an instance registers that existing object instead. |
3 private and internal methods
Used in
Members of other types that take, return or hold a Binder<TContract>: