Interface IMutableDependencyResolver
- Namespace
- Splat
- Assembly
- Splat.dll
Represents a dependency resolver where types can be registered after setup.
- Extension Methods
Methods
HasRegistration(Type?, string?)
Check to see if a resolvers has a registration for a type.
Parameters
serviceType
TypeThe type to check for registration.
contract
stringA optional contract value which will indicates to only generate the value if this contract is specified.
Returns
- bool
Whether there is a registration for the type.
Register(Func<object?>, Type?, string?)
Register a function with the resolver which will generate a object for the specified service type. Optionally a contract can be registered which will indicate that registration will only work with that contract. Most implementations will use a stack based approach to allow for multile items to be registered.
Parameters
factory
Func<object>The factory function which generates our object.
serviceType
TypeThe type which is used for the registration.
contract
stringA optional contract value which will indicates to only generate the value if this contract is specified.
ServiceRegistrationCallback(Type, string?, Action<IDisposable>)
Register a callback to be called when a new service matching the type and contract is registered.
When registered, the callback is also called for each currently matching service.
IDisposable ServiceRegistrationCallback(Type serviceType, string? contract, Action<IDisposable> callback)
Parameters
serviceType
TypeThe type which is used for the registration.
contract
stringA optional contract value which will indicates to only generate the value if this contract is specified.
callback
Action<IDisposable>The callback which will be called when the specified service type and contract are registered.
Returns
- IDisposable
When disposed removes the callback.
UnregisterAll(Type?, string?)
Unregisters all the values associated with the specified type and contract.
Parameters
serviceType
TypeThe service type to unregister.
contract
stringThe optional contract value, which will only remove the value associated with the contract.
UnregisterCurrent(Type?, string?)
Unregisters the current item based on the specified type and contract.