Unosquare
    Show / Hide Table of Contents

    Class JsonDataAttribute

    Specifies that a parameter of a controller method will receive an object obtained by deserializing the request body as JSON.

    The received object will be null only if the deserialized object is null.

    If the request body is not valid JSON, or if it cannot be deserialized to the type of the parameter, a 400 Bad Request response will be sent to the client.

    This class cannot be inherited.

    Inheritance
    Object
    JsonDataAttribute
    Implements
    IRequestDataAttribute<WebApiController>
    Namespace: EmbedIO.WebApi
    Syntax
    public class JsonDataAttribute : Attribute, IRequestDataAttribute<WebApiController>

    Methods

    GetRequestDataAsync(WebApiController, Type, String)

    Asynchronously obtains data from a controller's context.

    Declaration
    public Task<object> GetRequestDataAsync(WebApiController controller, Type type, string parameterName)
    Parameters
    Type Name Description
    WebApiController controller
    Type type

    The type of the parameter that has to receive the data.

    String parameterName

    The name of the parameter that has to receive the data.

    Returns
    Type Description
    Task<Object>

    a whose result will be the data to pass as a parameter to a controller method.

    Implements

    IRequestDataAttribute<TController>

    See Also

    IRequestDataAttribute<TController>

    Comments

    Back to top Copyright © 2017-2019 Unosquare