Class ConstructorParameterResolver
Resolves constructor parameters for types that have non default constructors. Will call registered IConstructorParameterResolver instances to resolve the parameters.
Inheritance
Namespace: EPiServer.Construction
Assembly: EPiServer.dll
Version: 12.0.3Syntax
[ServiceConfiguration]
public class ConstructorParameterResolver : Object
Remarks
Uses reflection to find the constructor with most parameters and tries to find parameters for that constructor.
Constructors
ConstructorParameterResolver()
Declaration
public ConstructorParameterResolver()
Properties
Instance
Gets the singleton instance.
Declaration
public static ConstructorParameterResolver Instance { get; }
Property Value
Type | Description |
---|---|
ConstructorParameterResolver | The instance. |
Remarks
The singleton is registered in IOC container. This is a convinent property to get the singelton instance for those who do not want to care about that there exist an IOC container.
Methods
GetConstructorArguments(Type)
Gets the constructor arguments to use for given type.
Declaration
public virtual IDictionary<string, object> GetConstructorArguments(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |
GetConstructorArgumentsAsList(Type)
Gets the constructor arguments to use for given type.
Declaration
public virtual IEnumerable<object> GetConstructorArgumentsAsList(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> |
RegisterResolver(IConstructorParameterResolver, Assembly)
Registers the resolver for types in specified Assembly.
Declaration
public virtual void RegisterResolver(IConstructorParameterResolver resolver, Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
IConstructorParameterResolver | resolver | The resolver. |
System.Reflection.Assembly | assembly | The assembly. |
Remarks
The registered instance might only be called when resolving constructor parameters for types in the specified assembly.