Class ResolutionExtensions
Extensions that enhance resolution of services.
Inheritance
Inherited Members
Namespace: Telerik.JustMock.AutoMock.Ninject
Assembly: Telerik.JustMock.dll
Syntax
public static class ResolutionExtensions
Methods
CanResolve(IResolutionRoot, Type, Func<IBindingMetadata, Boolean>, IParameter[])
Gets an instance of the specified service by using the first binding that matches the specified constraint.
Declaration
public static bool CanResolve(this IResolutionRoot root, Type service, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Boolean
|
CanResolve(IResolutionRoot, Type, String, IParameter[])
Gets an instance of the specified service by using the first binding with the specified name.
Declaration
public static bool CanResolve(this IResolutionRoot root, Type service, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Boolean
|
CanResolve(IResolutionRoot, Type, IParameter[])
Gets an instance of the specified service.
Declaration
public static bool CanResolve(this IResolutionRoot root, Type service, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Boolean
|
CanResolve<T>(IResolutionRoot, Func<IBindingMetadata, Boolean>, IParameter[])
Evaluates if an instance of the specified service by using the first binding that matches the specified constraint can be resolved.
Declaration
public static bool CanResolve<T>(this IResolutionRoot root, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Boolean
|
Type Parameters
T
The service to resolve. |
CanResolve<T>(IResolutionRoot, String, IParameter[])
Evaluates if an instance of the specified service by using the first binding with the specified name can be resolved.
Declaration
public static bool CanResolve<T>(this IResolutionRoot root, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Boolean
|
Type Parameters
T
The service to resolve. |
CanResolve<T>(IResolutionRoot, IParameter[])
Evaluates if an instance of the specified service can be resolved.
Declaration
public static bool CanResolve<T>(this IResolutionRoot root, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Boolean
|
Type Parameters
T
The service to resolve. |
Get(IResolutionRoot, Type, Func<IBindingMetadata, Boolean>, IParameter[])
Gets an instance of the specified service by using the first binding that matches the specified constraint.
Declaration
public static object Get(this IResolutionRoot root, Type service, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Object
An instance of the service. |
Get(IResolutionRoot, Type, String, IParameter[])
Gets an instance of the specified service by using the first binding with the specified name.
Declaration
public static object Get(this IResolutionRoot root, Type service, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Object
An instance of the service. |
Get(IResolutionRoot, Type, IParameter[])
Gets an instance of the specified service.
Declaration
public static object Get(this IResolutionRoot root, Type service, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Object
An instance of the service. |
Get<T>(IResolutionRoot, Func<IBindingMetadata, Boolean>, IParameter[])
Gets an instance of the specified service by using the first binding that matches the specified constraint.
Declaration
public static T Get<T>(this IResolutionRoot root, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service. |
Type Parameters
T
The service to resolve. |
Get<T>(IResolutionRoot, String, IParameter[])
Gets an instance of the specified service by using the first binding with the specified name.
Declaration
public static T Get<T>(this IResolutionRoot root, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service. |
Type Parameters
T
The service to resolve. |
Get<T>(IResolutionRoot, IParameter[])
Gets an instance of the specified service.
Declaration
public static T Get<T>(this IResolutionRoot root, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service. |
Type Parameters
T
The service to resolve. |
GetAll(IResolutionRoot, Type, Func<IBindingMetadata, Boolean>, IParameter[])
Gets all instances of the specified service by using the bindings that match the specified constraint.
Declaration
public static IEnumerable<object> GetAll(this IResolutionRoot root, Type service, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the bindings. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Collections.Generic.IEnumerable<System.Object>
A series of instances of the service. |
GetAll(IResolutionRoot, Type, String, IParameter[])
Gets all instances of the specified service using bindings registered with the specified name.
Declaration
public static IEnumerable<object> GetAll(this IResolutionRoot root, Type service, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Collections.Generic.IEnumerable<System.Object>
A series of instances of the service. |
GetAll(IResolutionRoot, Type, IParameter[])
Gets all available instances of the specified service.
Declaration
public static IEnumerable<object> GetAll(this IResolutionRoot root, Type service, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Collections.Generic.IEnumerable<System.Object>
A series of instances of the service. |
GetAll<T>(IResolutionRoot, Func<IBindingMetadata, Boolean>, IParameter[])
Gets all instances of the specified service by using the bindings that match the specified constraint.
Declaration
public static IEnumerable<T> GetAll<T>(this IResolutionRoot root, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the bindings. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Collections.Generic.IEnumerable<T>
A series of instances of the service. |
Type Parameters
T
The service to resolve. |
GetAll<T>(IResolutionRoot, String, IParameter[])
Gets all instances of the specified service using bindings registered with the specified name.
Declaration
public static IEnumerable<T> GetAll<T>(this IResolutionRoot root, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Collections.Generic.IEnumerable<T>
A series of instances of the service. |
Type Parameters
T
The service to resolve. |
GetAll<T>(IResolutionRoot, IParameter[])
Gets all available instances of the specified service.
Declaration
public static IEnumerable<T> GetAll<T>(this IResolutionRoot root, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Collections.Generic.IEnumerable<T>
A series of instances of the service. |
Type Parameters
T
The service to resolve. |
TryGet(IResolutionRoot, Type, Func<IBindingMetadata, Boolean>, IParameter[])
Tries to get an instance of the specified service by using the first binding that matches the specified constraint.
Declaration
public static object TryGet(this IResolutionRoot root, Type service, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Object
An instance of the service, or null if no implementation was available. |
TryGet(IResolutionRoot, Type, String, IParameter[])
Tries to get an instance of the specified service by using the first binding with the specified name.
Declaration
public static object TryGet(this IResolutionRoot root, Type service, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Object
An instance of the service, or null if no implementation was available. |
TryGet(IResolutionRoot, Type, IParameter[])
Tries to get an instance of the specified service.
Declaration
public static object TryGet(this IResolutionRoot root, Type service, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Type
service
The service to resolve. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
System.Object
An instance of the service, or null if no implementation was available. |
TryGet<T>(IResolutionRoot, Func<IBindingMetadata, Boolean>, IParameter[])
Tries to get an instance of the specified service by using the first binding that matches the specified constraint.
Declaration
public static T TryGet<T>(this IResolutionRoot root, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service, or null if no implementation was available. |
Type Parameters
T
The service to resolve. |
TryGet<T>(IResolutionRoot, String, IParameter[])
Tries to get an instance of the specified service by using the first binding with the specified name.
Declaration
public static T TryGet<T>(this IResolutionRoot root, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service, or null if no implementation was available. |
Type Parameters
T
The service to resolve. |
TryGet<T>(IResolutionRoot, IParameter[])
Tries to get an instance of the specified service.
Declaration
public static T TryGet<T>(this IResolutionRoot root, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service, or null if no implementation was available. |
Type Parameters
T
The service to resolve. |
TryGetAndThrowOnInvalidBinding<T>(IResolutionRoot, Func<IBindingMetadata, Boolean>, IParameter[])
Tries to get an instance of the specified service by using the first binding that matches the specified constraint.
Declaration
public static T TryGetAndThrowOnInvalidBinding<T>(this IResolutionRoot root, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service, or null if no implementation was available. |
Type Parameters
T
The service to resolve. |
TryGetAndThrowOnInvalidBinding<T>(IResolutionRoot, String, IParameter[])
Tries to get an instance of the specified service by using the first binding with the specified name.
Declaration
public static T TryGetAndThrowOnInvalidBinding<T>(this IResolutionRoot root, string name, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
System.String
name
The name of the binding. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service, or null if no implementation was available. |
Type Parameters
T
The service to resolve. |
TryGetAndThrowOnInvalidBinding<T>(IResolutionRoot, IParameter[])
Tries to get an instance of the specified service.
Declaration
public static T TryGetAndThrowOnInvalidBinding<T>(this IResolutionRoot root, params IParameter[] parameters)
Parameters
IResolutionRoot
root
The resolution root. |
IParameter[]
parameters
The parameters to pass to the request. |
Returns
T
An instance of the service, or null if no implementation was available. |
Type Parameters
T
The service to resolve. |