wizdl Implementation (CodeDOM API + PropertyGrid)

Aug 10, 2008 at 2:03 PM
Edited Aug 10, 2008 at 2:45 PM
wizdl works by tweaking (using CodeDOM API) the client side classes generated from a WSDL and makes them fully editable in a property grid.

The ServiceDescriptionImporter class that ships with .NET allows you to generate client side code for a WSDL.

But the classes it generates have a couple of limitations that makes it impossible to bind them to a GUI.

a. It generates fields instead of properties hence they wont show up in a property grid
b. Even if it generates properties (2.0 version) they still wont be completely editable in a property grid

Using the CodeDOM API wizdl:
  1. Promotes fields to properties
  2. Sticks ExpandableObjectConverter attribute to the properties so that they can be edited easily from a property grid
  3. Adds a custom property editor attribute so that derived class objects can be created and edited
  4. Adds a custom array editor attribute so that arrays can be edited
The meat of the code is in the CustomProxyGenerator class

In .NET 2.0 we can eliminate the CodeDOM stuff and use the TypeDescriptionProvider class to augment properties during run time - but then the code loses all its coolness :-)