Share via


ApiController.Validate Method

 

Namespace:   System.Web.Http
Assembly:  System.Web.Http (in System.Web.Http.dll)

Overload List

Name Description
System_CAPS_pubmethod Validate<TEntity>(TEntity)

Validates the given entity and adds the validation errors to the model state under the empty prefix, if any.

System_CAPS_pubmethod Validate<TEntity>(TEntity, String)

Validates the given entity and adds the validation errors to the model state, if any.

See Also

ApiController Class
System.Web.Http Namespace

Return to top

ApiController.Validate<TEntity> Method (TEntity)

Validates the given entity and adds the validation errors to the model state under the empty prefix, if any.

Syntax

public void Validate<TEntity>(
    TEntity entity
)
public:
generic<typename TEntity>
void Validate(
    TEntity entity
)
member Validate<'TEntity> : 
        entity:'TEntity -> unit
Public Sub Validate(Of TEntity) (
    entity As TEntity
)

Parameters

  • entity
    Type: TEntity

    The entity being validated.

Type Parameters

  • TEntity
    The type of the entity to be validated.

Return to top

ApiController.Validate<TEntity> Method (TEntity, String)

Validates the given entity and adds the validation errors to the model state, if any.

Syntax

public void Validate<TEntity>(
    TEntity entity,
    string keyPrefix
)
public:
generic<typename TEntity>
void Validate(
    TEntity entity,
    String^ keyPrefix
)
member Validate<'TEntity> : 
        entity:'TEntity *
        keyPrefix:string -> unit
Public Sub Validate(Of TEntity) (
    entity As TEntity,
    keyPrefix As String
)

Parameters

  • entity
    Type: TEntity

    The entity being validated.

  • keyPrefix
    Type: System.String

    The key prefix under which the model state errors would be added in the model state.

Type Parameters

  • TEntity
    The type of the entity to be validated.

Return to top