Interface IResolver
An IResolver enables the dependency to be resolved based on the contract type and an optional id.
This interface should not be cached in any object unless its a service level object.
Assembly: cs.temp.dll.dll
Syntax
public interface IResolver
Methods
CanResolve(Type)
Check if the dependency based on the type
type exists in the IContainer.
Declaration
bool CanResolve(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
Examples
CanResolve(typeof(IInterface)) == true;
CanResolve(Type, Object)
Check if the dependency based on the type
type associated with the id
exists in the IContainer
Declaration
bool CanResolve(Type type, object id)
Parameters
Returns
Examples
CanResolve(typeof(IInterface), "foo") == true;
CanResolve<TContract>()
Check if the dependency based on the TContract
type exists in the
IContainer.
Declaration
bool CanResolve<TContract>()
Returns
Type Parameters
Name |
Description |
TContract |
|
Examples
CanResolve<IInterface>() == true;
CanResolve<TContract>(Object)
Check if the dependency based on the TContract
type associated with the
id
type exists in the IContainer.
Declaration
bool CanResolve<TContract>(object id)
Parameters
Type |
Name |
Description |
Object |
id |
|
Returns
Type Parameters
Name |
Description |
TContract |
|
Examples
CanResolve<IInterface>("foo") == true;
Resolve(Type)
Resolve and return the dependency based on the type
type.
Declaration
object Resolve(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
Examples
object foo = Resolve(typeof(IInterface));
Resolve(Type, Object)
Resolve and return the dependency based on the type
type associated with the
id
.
Declaration
object Resolve(Type type, object id)
Parameters
Returns
Examples
object foo = Resolve(typeof(IInterface), "foo");
Resolve<TContract>()
Resolve and return the dependency based on the TContract
type.
Declaration
TContract Resolve<TContract>()
Returns
Type |
Description |
TContract |
|
Type Parameters
Name |
Description |
TContract |
|
Examples
IInterface foo = Resolve<IInterface>();
Resolve<TContract>(Object)
Resolve and return the dependency based on the TContract
type associated with
the id
.
Declaration
TContract Resolve<TContract>(object id)
Parameters
Type |
Name |
Description |
Object |
id |
|
Returns
Type |
Description |
TContract |
|
Type Parameters
Name |
Description |
TContract |
|
Examples
IInterface foo = Resolve<IInterface>("foo");
ResolveAll(Type)
Resolve and return all the dependencies based on the type
type.
Declaration
object[] ResolveAll(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
Examples
object[] foos = ResolveAll(typeof(IInterface));
ResolveAll(Type, Object[])
Resolve and return all the dependencies based on the type
type associated with
the ids
.
Declaration
object[] ResolveAll(Type type, object[] ids)
Parameters
Returns
Examples
object[] foos = ResolveAll(typeof(IInterface), ids);
ResolveAll<TContract>()
Resolve and return all the dependencies based on the TContract
type.
Declaration
TContract[] ResolveAll<TContract>()
Returns
Type |
Description |
TContract[] |
|
Type Parameters
Name |
Description |
TContract |
|
Examples
IInterface[] foos = ResolveAll<IInterface>();
ResolveAll<TContract>(Object[])
Resolve and return all the dependencies based on the TContract
type associated with
the ids
.
Declaration
TContract[] ResolveAll<TContract>(object[] ids)
Parameters
Type |
Name |
Description |
Object[] |
ids |
|
Returns
Type |
Description |
TContract[] |
|
Type Parameters
Name |
Description |
TContract |
|
Examples
IInterface[] foos = ResolveAll<IInterface>(ids);
ResolveAll<TContract>(Predicate<TContract>)
Resolve and return all the dependencies that satisfied the predicate
.
Declaration
TContract[] ResolveAll<TContract>(Predicate<TContract> predicate)
Parameters
Type |
Name |
Description |
Predicate<TContract> |
predicate |
|
Returns
Type |
Description |
TContract[] |
|
Type Parameters
Name |
Description |
TContract |
|
Examples
IInterface[] foos = ResolveAll<IInterface>(item => item.GetType() == typeof(TContract));