Interface IBagRegistrar
- Namespace
- Mokkit.Containers.Bag
- Assembly
- Mokkit.Containers.Bag.dll
The registration surface of a Mokkit.Containers.Bag.BagContainerBuilder, handed to Mokkit.Containers.Bag.BagContainerBuilder.UseInit(System.Func{Mokkit.Containers.Bag.IBagRegistrar,System.Threading.Tasks.Task}) callbacks so services can be registered without exposing the builder lifecycle.
public interface IBagRegistrarMethods
AddFactory<T>(Func<T>)
Registers a factory that produces a value resolved by its type T.
The factory is invoked at most once per scope; the produced value is disposed on scope disposal if it is System.IDisposable.
IBagRegistrar AddFactory<T>(Func<T> factory) where T : classParameters
factoryFunc<T>-
The factory that creates the value.
Returns
- IBagRegistrar
-
The registrar for fluent chaining.
Type Parameters
T-
The type under which the produced value is resolved (may be an interface or a concrete type).
AddInstance<T>(T)
Registers a pre-built instance to be resolved by its own type T.
The instance is shared across all scopes and is not disposed by the container — the caller owns its lifetime.
IBagRegistrar AddInstance<T>(T instance) where T : classParameters
instanceT-
The instance to store.
Returns
- IBagRegistrar
-
The registrar for fluent chaining.
Type Parameters
T-
The type under which the instance is resolved (may be an interface or a concrete type).