Home > Net >  The.net WebApi parameter validation
The.net WebApi parameter validation

Time:10-19

I use vs 2017 database is sqlserver2012, id is of type int, the.net WebApi interface using the postman tool test validate the input parameters of type
To solve the

CodePudding user response:

Your id defined data type is int, you send a e, int is the e?

CodePudding user response:

Not, is to validate the input is not how to validate parameter of type int

CodePudding user response:

Use the object parameters, within a method validation data types

CodePudding user response:

reference 1st floor jikeyshi response:
using the object parameters, method validation data type


Can give a specific answer?

CodePudding user response:

reference 1/f, Eva will hit soy sauce response:
your id defined data type is int, you send a e, int is the e?

Not, is to validate the input is not how to validate parameter of type int

CodePudding user response:

Using a int? Id

If (id. HasValue)
{
I am INT
}

CodePudding user response:

refer to 6th floor q363186 response:
use int? Id

If (id. HasValue)
{
I am INT
}

How to use? Need to write a helper classes? Have to use the core webapi

CodePudding user response:

refer to 7th floor L159347163128 response:
Quote: refer to the sixth floor q363186 response:

Using a int? Id

If (id. HasValue)
{
I am INT
}

How to use? Need to write a helper classes? Is there any use to the core webapi

Are you sure you can receive normal parameters? Can determine yourself to be a real and add validation features, like the MVC that a set of
  • Related