ActionDescriptorExtensions

Namespace: ASPSecurityKit.NetCore
Assembly: ASPSecurityKit.NetCore.dll

Summary

Provides extension methods for action/controller Descriptors.

Methods

IsDefinedOnActionOrController<T>(actionDescriptor,inherit)

Summary

Determines whether the given attribute is defined for the specified action or its controller. The one on action will get precedence.

Returns

true if the given attribute is defined for the specified action or its controller; otherwise, false.

Parameters
Name Type Description
actionDescriptor Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor The action descriptor.
inherit System.Boolean Indicates whether to consider inherited attributes as well.
Generic Types
Name Description
T Type of the attribute to search for.

IsDefinedOnController<T>(actionDescriptor,inherit)

Summary

Determines whether the given attribute is defined for the specified action’s controller.

Returns

true if the given attribute is defined for the specified action’s controller; otherwise, false.

Parameters
Name Type Description
actionDescriptor Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor The action descriptor.
inherit System.Boolean Indicates whether to consider inherited attributes as well.
Generic Types
Name Description
T Type of the attribute to search for.

GetCustomAttributeFromActionOrController<T>(actionDescriptor,inherit)

Summary

Gets the first instance of the given attribute if it is defined for the specified action or its controller. The one on action will get precedence.

Returns

The first instance of the given attribute if it is defined for the specified action or its controller; otherwise, null.

Parameters
Name Type Description
actionDescriptor Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor The action descriptor.
inherit System.Boolean Indicates whether to consider inherited attributes as well.
Generic Types
Name Description
T Type of the attribute to search for.

GetCustomAttributeFromActionOrController<T>(controllerActionDescriptor,inherit)

Summary

Gets the first instance of the given attribute if it is defined for the specified action or its controller. The one on action will get precedence.

Returns

The first instance of the given attribute if it is defined for the specified action or its controller; otherwise, null.

Parameters
Name Type Description
controllerActionDescriptor Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor The controller action descriptor.
inherit System.Boolean Indicates whether to consider inherited attributes as well.
Generic Types
Name Description
T Type of the attribute to search for.

GetCustomAttributeFromAction<T>(controllerActionDescriptor,inherit)

Summary

Gets the first instance of the given attribute if it is defined for the specified action.

Returns

The first instance of the given attribute if it is defined for the specified action; otherwise, null.

Parameters
Name Type Description
controllerActionDescriptor Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor The controller action descriptor.
inherit System.Boolean Indicates whether to consider inherited attributes as well.
Generic Types
Name Description
T Type of the attribute to search for.

GetCustomAttributeFromController<T>(controllerActionDescriptor,inherit)

Summary

Gets the first instance of the given attribute if it is defined for the specified action’s controller.

Returns

The first instance of the given attribute if it is defined for the specified action’s controller; otherwise, null.

Parameters
Name Type Description
controllerActionDescriptor Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor The controller action descriptor.
inherit System.Boolean Indicates whether to consider inherited attributes as well.
Generic Types
Name Description
T Type of the attribute to search for.

GetOperationName(actionDescriptor)

Summary

Gets the name of the operation from the specified action metadata.

Returns

The name of the operation from the specified action metadata.

Parameters
Name Type Description
actionDescriptor Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor The action descriptor.

GetActionReturnType(actionDescriptor)

Summary

Gets the return type of the operation from the specified action metadata.

Returns

The return type of the operation from the specified action metadata.

Parameters
Name Type Description
actionDescriptor Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor The action descriptor.