ActionResultObjectValueAttribute Class

Definition

Attribute annotated on ActionResult constructor, helper method parameters, and properties to indicate that the parameter or property is used to set the "value" for ActionResult.

Analyzers match this parameter by type name. This allows users to annotate custom results \ custom helpers with a user-defined attribute without having to expose this type.

This attribute is intentionally marked Inherited=false since the analyzer does not walk the inheritance graph.

public ref class ActionResultObjectValueAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)]
public sealed class ActionResultObjectValueAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)>]
type ActionResultObjectValueAttribute = class
    inherit Attribute
Public NotInheritable Class ActionResultObjectValueAttribute
Inherits Attribute
Inheritance
ActionResultObjectValueAttribute
Attributes

Examples

Annotated constructor parameter:

public BadRequestObjectResult([ActionResultObjectValue] object error)
    :base(error)
{
    StatusCode = DefaultStatusCode;
}

Annotated property:

public class ObjectResult : ActionResult, IStatusCodeActionResult
{
    [ActionResultObjectValue]
    public object Value { get; set; }
}

Constructors

ActionResultObjectValueAttribute()

Applies to