Class ActionDescriptor
Provides information about an action method, such as its name, controller, parameters, attributes, and filters.
public abstract class ActionDescriptor : ICustomAttributeProvider
- Inheritance
-
ActionDescriptor
- Implements
- Derived
- Inherited Members
Constructors
ActionDescriptor()
Initializes a new instance of the ActionDescriptor class.
protected ActionDescriptor()
Properties
ActionName
Gets the name of the action method.
public abstract string ActionName { get; }
Property Value
- string
The name of the action method.
ControllerDescriptor
Gets the controller descriptor.
public abstract ControllerDescriptor ControllerDescriptor { get; }
Property Value
- ControllerDescriptor
The controller descriptor.
UniqueId
Gets the unique ID for the action descriptor using lazy initialization.
public virtual string UniqueId { get; }
Property Value
- string
The unique ID.
Methods
Execute(ControllerContext, IDictionary<string, object>)
Executes the action method by using the specified parameters and controller context.
public abstract object Execute(ControllerContext controllerContext, IDictionary<string, object> parameters)
Parameters
controllerContextControllerContextThe controller context.
parametersIDictionary<string, object>The parameters of the action method.
Returns
- object
The result of executing the action method.
GetCustomAttributes(bool)
Returns an array of custom attributes that are defined for this member, excluding named attributes.
public virtual 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 that are defined for this member, identified by type.
public virtual 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 of the specified type exist.
Exceptions
- TypeLoadException
The custom attribute type cannot be loaded.
- AmbiguousMatchException
There is more than one attribute of type
attributeTypedefined for this member.- ArgumentNullException
The
attritubeTypeparameter is null.
GetFilterAttributes(bool)
Gets the filter attributes.
public virtual IEnumerable<FilterAttribute> GetFilterAttributes(bool useCache)
Parameters
useCachebooltrue to use the cache, otherwise false.
Returns
- IEnumerable<FilterAttribute>
The filter attributes.
GetParameters()
Returns the parameters of the action method.
public abstract ParameterDescriptor[] GetParameters()
Returns
- ParameterDescriptor[]
The parameters of the action method.
GetSelectors()
Returns the action-method selectors.
public virtual ICollection<ActionSelector> GetSelectors()
Returns
- ICollection<ActionSelector>
The action-method selectors.
IsDefined(Type, bool)
Determines whether one or more instances of the specified attribute type are defined for this member.
public virtual bool IsDefined(Type attributeType, bool inherit)
Parameters
attributeTypeTypeThe type of the custom attribute.
inheritbooltrue to look up the hierarchy chain for the inherited custom attribute; otherwise, false.
Returns
- bool
true if
attributeTypeis defined for this member; otherwise, false.
Exceptions
- ArgumentNullException
The
attritubeTypeparameter is null.