Can I Assign User-Defined Class Name to OverloadType's typeName in validation.xml

Apr 11, 2008 at 3:01 AM
Hi Simon,

An Example in document like this:

<method name="SetTheAge">
<overloadType typeName="System.Int32"/>
<parameter name="age">
<rule typeName="RangeRule" minimum="18" maximum="80"
errorMessage="Age is invalid" />
</parameter>
</method>

Can I use the class that my wrote to replace "System.Int32"?

I had tried to use "NameSpace.ClassName", but it doesn't work.

It can't find the definition of this class.

How could I solve this?

Thanks for your help!

Jeff Lee


Coordinator
Apr 11, 2008 at 4:13 AM
The fully qualified type name should work.
Try "NameSpace.ClassName,AssemblyName"

If that doesn’t work it is a bug.

For some (limited) doco on those classes have a look at
"ValidationFramework.Configuration.MethodData" (\ValidationFramework\Configuration\DataClasses\MethodData.cs) and
"ValidationFramework.Configuration.TypeData" (\ValidationFramework\Configuration\DataClasses\TypeData.cs)

The xml configuration is basically a serialized version of the various "ValidationFramework.Configuration.XXXData" classes.

I will update the doco, on the next release, to better explain this scenario

Regards

Simon
Coordinator
Apr 11, 2008 at 4:46 AM
it might help to know that internally the "overloadType" value is passed to Type.GetType(string, bool)
http://msdn2.microsoft.com/en-us/library/aa332510(VS.71).aspx
Apr 11, 2008 at 9:29 AM
Hi Simon,

I tried "NameSpace.ClassName,AssemblyName".

Now, it's work.

Thanks for your help!

Jeff Lee