开发者

Pass parameter client to server-side with RIA services

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开发者_Python百科  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!


You can add the validation_mode to the ValidationContext:

ValidationContext.Items.Add(new KeyValuePair<object,object>("validation_mode", validation_mode)); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜