RegEx validation using attibutes

S

Steve James

Is there a way to use a regular expression to validate a string in an
object/soap message passed to a web service without performing a full
schema validation? What I would like to do is something like:


public class WebServiceRequest
{

private string _aString;

[RegexValidation( Pattern="<Regular Expression goes here>")]
public string AString
{
get{ return _aString; }
set{ _aString = value; }
}
}

Does such an attribute or other construct exist which causes the
property to be validated against a regular expression by the web
service infrastructure automatically when the soap request is
deserialized?

Steve
 
S

Steve James

The [RegexValidation( Pattern="<Regular Expression goes here>")]
attribute doesn't exist - I made it up. I probably didn't make it clear
in my original post, but this is the type of construct I would like to
use if there is one. Just as you can control Xml serialization and
deserialization with attributes such as XmlIgnore and XmlElement I
thought there may be something similar to match a property against a
regular expression.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top