Class TaskAsyncActionDescriptor
When an action method returns either Task or Task<T> the TaskAsyncActionDescriptor provides information about the action.
public class TaskAsyncActionDescriptor : AsyncActionDescriptor, ICustomAttributeProvider, IMethodInfoActionDescriptor
- Inheritance
-
TaskAsyncActionDescriptor
- Implements
- Inherited Members
Constructors
TaskAsyncActionDescriptor(MethodInfo, string, ControllerDescriptor)
Initializes a new instance of the TaskAsyncActionDescriptor class.
public TaskAsyncActionDescriptor(MethodInfo taskMethodInfo, string actionName, ControllerDescriptor controllerDescriptor)
Parameters
taskMethodInfo
MethodInfoThe task method information.
actionName
stringThe action name.
controllerDescriptor
ControllerDescriptorThe controller descriptor.
Properties
ActionName
Gets the name of the action method.
public override string ActionName { get; }
Property Value
- string
The name of the action method.
ControllerDescriptor
Gets the controller descriptor.
public override ControllerDescriptor ControllerDescriptor { get; }
Property Value
- ControllerDescriptor
The controller descriptor.
MethodInfo
Gets the MethodInfo
public MethodInfo MethodInfo { get; }
Property Value
TaskMethodInfo
Gets information for the asynchronous task.
public MethodInfo TaskMethodInfo { get; }
Property Value
- MethodInfo
Information for the asynchronous task.
UniqueId
Gets the unique ID for the task.
public override string UniqueId { get; }
Property Value
- string
The unique ID for the task.
Methods
BeginExecute(ControllerContext, IDictionary<string, object>, AsyncCallback, object)
Invokes the asynchronous action method using the specified parameters, controller context callback and state.
public override IAsyncResult BeginExecute(ControllerContext controllerContext, IDictionary<string, object> parameters, AsyncCallback callback, object state)
Parameters
controllerContext
ControllerContextThe controller context.
parameters
IDictionary<string, object>The parameters of the action method.
callback
AsyncCallbackThe optional callback method.
state
objectAn object that contains information to be used by the callback method. This parameter can be null.
Returns
- IAsyncResult
An object that contains the result of an asynchronous call.
EndExecute(IAsyncResult)
Ends the asynchronous operation.
public override object EndExecute(IAsyncResult asyncResult)
Parameters
asyncResult
IAsyncResultAn object that represents the status of an asynchronous operation.
Returns
- object
The result of an asynchronous operation.
Execute(ControllerContext, IDictionary<string, object>)
Executes the asynchronous action method
public override object Execute(ControllerContext controllerContext, IDictionary<string, object> parameters)
Parameters
controllerContext
ControllerContextThe controller context.
parameters
IDictionary<string, object>The parameters of the action method.
Returns
- object
The result of executing the asynchronous action method.
GetCustomAttributes(bool)
Returns an array of custom attributes that are defined for this member, excluding named attributes.
public override object[] GetCustomAttributes(bool inherit)
Parameters
inherit
booltrue 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.
GetCustomAttributes(Type, bool)
Returns an array of custom attributes that are defined for this member, identified by type.
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Parameters
attributeType
TypeThe type of the custom attributes.
inherit
booltrue 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.
GetFilterAttributes(bool)
Returns an array of all custom attributes applied to this member.
public override IEnumerable<FilterAttribute> GetFilterAttributes(bool useCache)
Parameters
useCache
booltrue to search this member's inheritance chain to find the attributes; otherwise, false.
Returns
- IEnumerable<FilterAttribute>
An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
GetParameters()
Returns the parameters of the asynchronous action method.
public override ParameterDescriptor[] GetParameters()
Returns
- ParameterDescriptor[]
The parameters of the asynchronous action method.
GetSelectors()
Returns the asynchronous action-method selectors.
public override ICollection<ActionSelector> GetSelectors()
Returns
- ICollection<ActionSelector>
The asynchronous action-method selectors.
IsDefined(Type, bool)
Returns a value that indicates whether one or more instance of the specified custom attribute are defined for this member.
public override bool IsDefined(Type attributeType, bool inherit)
Parameters
attributeType
TypeThe type of the custom attribute.
inherit
booltrue to look up the hierarchy chain for the inherited custom attribute; otherwise, false.
Returns
- bool
A value that indicates whether one or more instance of the specified custom attribute are defined for this member.