Interface IInjector
Provides the mechanism for injecting resources.
Inherited Members
Namespace: Solti.Utils.DI.Interfaces
Assembly: Solti.Utils.DI.Interfaces.dll
Syntax
public interface IInjector : IHasTag
Properties
Options
Describes the scope behavior.
Declaration
ScopeOptions Options { get; }
Property Value
| Type | Description |
|---|---|
| ScopeOptions |
Methods
Get(Type, Object)
Gets the service instance associated with the given type and (optional) key.
Declaration
object Get(Type type, object key = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type | The "id" of the service to be resolved. |
| System.Object | key | The (optional) key of the service (usually a name). |
Returns
| Type | Description |
|---|---|
| System.Object | The resolved service. |
Exceptions
| Type | Condition |
|---|---|
| ServiceNotFoundException | The service or one or more dependencies could not be found. |
TryGet(Type, Object)
Tries to get the service instance associated with the given type and (optional) key.
Declaration
object TryGet(Type type, object key = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type | The "id" of the service to be resolved. |
| System.Object | key | The (optional) key of the service (usually a name). |
Returns
| Type | Description |
|---|---|
| System.Object | The requested service instance or NULL. |