I'm using RIA Services with EF and a Silverlight UI and the built-in validation framework. Problem is the following:
The validation rules differ slightly based on user-input client-side, consider this simple scenario.
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
if (validation_mode == Modes.Normal)
{
// do normal validation
}
else
{
// do admin validation
}
}
I'd like a way to pass the 'validation_mode' to RIA services, server-side. Can i somehow pass it to the ValidationContext.Items collection? Perhaps I'm going about this the wrong way?
Thanks in advance!
您可以将validation_mode添加到ValidationContext:
ValidationContext.Items.Add(new KeyValuePair<object,object>("validation_mode", validation_mode));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.