Class ReflectedActionDescriptor
Contains information that describes a reflected action method.
public class ReflectedActionDescriptor : ActionDescriptor, ICustomAttributeProvider, IMethodInfoActionDescriptor
- Inheritance
-
ReflectedActionDescriptor
- Implements
- Inherited Members
Constructors
ReflectedActionDescriptor(MethodInfo, string, ControllerDescriptor)
Initializes a new instance of the ReflectedActionDescriptor class.
public ReflectedActionDescriptor(MethodInfo methodInfo, string actionName, ControllerDescriptor controllerDescriptor)
Parameters
methodInfoMethodInfoThe action-method information.
actionNamestringThe name of the action.
controllerDescriptorControllerDescriptorThe controller descriptor.
Exceptions
- ArgumentNullException
Either the
methodInfoorcontrollerDescriptorparameter is null.- ArgumentException
The
actionNameparameter is null or empty.
Properties
ActionName
Gets the name of the action.
public override string ActionName { get; }
Property Value
- string
The name of the action.
ControllerDescriptor
Gets the controller descriptor.
public override ControllerDescriptor ControllerDescriptor { get; }
Property Value
- ControllerDescriptor
The controller descriptor.
MethodInfo
Gets or sets the action-method information.
public MethodInfo MethodInfo { get; }
Property Value
- MethodInfo
The action-method information.
UniqueId
Gets the unique ID for the reflected action descriptor using lazy initialization.
public override string UniqueId { get; }
Property Value
- string
The unique ID.
Methods
Execute(ControllerContext, IDictionary<string, object>)
Executes the specified controller context by using the specified action-method parameters.
public override object Execute(ControllerContext controllerContext, IDictionary<string, object> parameters)
Parameters
controllerContextControllerContextThe controller context.
parametersIDictionary<string, object>The parameters.
Returns
- object
The action return value.
Exceptions
- ArgumentNullException
The
parametersorcontrollerContextparameter is null.
GetCustomAttributes(bool)
Returns an array of custom attributes defined for this member, excluding named attributes.
public override object[] GetCustomAttributes(bool inherit)
Parameters
inheritbooltrue to look up the hierarchy chain for the inherited custom attribute; otherwise, false.
Returns
- object[]
An array of custom attributes, or an empty array if no custom attributes exist.
Exceptions
- TypeLoadException
The custom attribute type cannot be loaded.
- AmbiguousMatchException
There is more than one attribute of type
attributeTypedefined for this member.
GetCustomAttributes(Type, bool)
Returns an array of custom attributes defined for this member, identified by type.
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Parameters
attributeTypeTypeThe type of the custom attributes.
inheritbooltrue to look up the hierarchy chain for the inherited custom attribute; otherwise, false.
Returns
- object[]
An array of custom attributes, or an empty array if no custom attributes exist.
Exceptions
- TypeLoadException
The custom attribute type cannot be loaded.
- AmbiguousMatchException
There is more than one attribute of type
attributeTypedefined for this member.
GetFilterAttributes(bool)
Gets the filter attributes.
public override IEnumerable<FilterAttribute> GetFilterAttributes(bool useCache)
Parameters
useCachebooltrue to use the cache, otherwise false.
Returns
- IEnumerable<FilterAttribute>
The filter attributes.
GetParameters()
Retrieves the parameters of the action method.
public override ParameterDescriptor[] GetParameters()
Returns
- ParameterDescriptor[]
The parameters of the action method.
GetSelectors()
Retrieves the action selectors.
public override ICollection<ActionSelector> GetSelectors()
Returns
- ICollection<ActionSelector>
The action selectors.
IsDefined(Type, bool)
Indicates whether one or more instances of a custom attribute type are defined for this member.
public override bool IsDefined(Type attributeType, bool inherit)
Parameters
attributeTypeTypeThe type of the custom attributes.
inheritbooltrue to look up the hierarchy chain for the inherited custom attribute; otherwise, false.
Returns
- bool
true if the custom attribute type is defined for this member; otherwise, false.