DNAP — Parameter Validation

I've been wanting to add some way of auto validating parameters passed to ajax methods.  Since we know the method parameters of the server method we're calling through ajax, we should be able to auto-magically determine the validation.  I've added an property to the GenericAjaxMethodAttribute where the auto validation of parameters can be toggled on and off.  The attribute looks like this now:

using System;
namespace DNAP
{
    public class GenericAjaxMethodAttribute : System.Attribute
    {
    	private bool _validateParameters = false;
    	public bool ValidateParameters
    	{
    		get
    		{
    			return _validateParameters;
    		}
    	}
    	/// 
    	/// Initializes a new instance of the GenericAjaxMethodAttribute class.
    	/// 
    	/// 
    	public GenericAjaxMethodAttribute(bool validateParameters)
    	{
    		_validateParameters = validateParameters;
    	}
    	/// 
    	/// Initializes a new instance of the GenericAjaxMethodAttribute class.
    	/// 
    	public GenericAjaxMethodAttribute()
    	{
    	}
    }
}

The more I think about the more I need to re-work my examples. Here is the new demo.  It adds some basic validation to the parameters in the actual call.  I like that, it's simple, if you don't want it you don't get it(by default), and it should already be there to begin with.  I realize that we should already be doing input validation, but why not throw another layer of support into the mix.  If a dot net method accepts an int, you know it's gonna blow up if you send in something that's not an int from the client, so the ajax library should offer that simple validation without any hassle.  The example I've added is sooper lame, mostly just a proof of concept, and while posting I just noticed that I'm not able to round trip objects through the ajax proxy which is not cool, so I need to figure out where or why that doesn't work.  The zip file is updated with my latest code.

 
Author: , 0000-00-00