I'm trying to validate input parameters passed in my WCF service, For example, i want to ensure that the coming string parameter is not empty and its length = 10, if not , return an error message.
I Tried to add DataAnnotations, as follows :
public class Garantie
{
#region fields
[Required]
[StringLength(10, MinimumLength = 10, ErrorMessage = "String length should be 10.")]
string CODE_BRANCHE;
[Required]
[Range(1,1, ErrorMessage = " length should be 1.")]
int CODE_SOUS_BRANCHE;
#endregion}
But this is not working. How can i fix this ?