Automatic service parameter validation using data annotations

Topics: Web Api
Feb 8, 2011 at 7:43 PM

Is this supported?

Like:

 

public Token SignIn(
   [Required(AllowEmptyStrings = false, 
                  ErrorMessageResourceType = typeof(Resources), 
                  ErrorMessageResourceName = "Authentication_VerificationCode_CanNotBeNullOrEmpty")] 
   string verificacionCode, 
   HttpResponseMessage response)

 

(where a processor does the validation and automatically stops processing with presumably a Bad Request status code?)

Coordinator
Feb 8, 2011 at 9:33 PM
Not out of the box, but I have been thinking to author a processor to to it, should be pretty easy.

Sent from my Windows Phone

From: dcazzulino
Sent: Tuesday, February 08, 2011 11:44 AM
To: Glenn Block
Subject: Automatic service parameter validation using data annotations [wcf:245160]

From: dcazzulino

Is this supported?

Like:

public Token SignIn(
[Required(AllowEmptyStrings = false,
ErrorMessageResourceType = typeof(Resources),
ErrorMessageResourceName = "Authentication_VerificationCode_CanNotBeNullOrEmpty")]
string verificacionCode,
HttpResponseMessage response)

(where a processor does the validation and automatically stops processing with presumably a Bad Request status code?)