So here is my first attempt. After 1 day Iâ€™ve built something that would have been very useful in the old days.
The recipe is a simple xsd to class generator by just right-click on *.xsd files (no wizards, no input). I thought that Whidbey was going to improve xsd.exe but it didnâ€™t. It is just the same as before but with property generation instead of fields.
This is a very first version that generates a c# entity by right clicking the xsd on a project. It still needs some refactoring, some fixes and some missing features, but it works. My assignment was to make a proof of concept on the GAT technology and provide feedback about it to the blueprint architect. We believe that GAT recipes are great because they are more user friendly than using VS external tools.
The current features are:
Generates c# class/es by right click on the xsd on a project
Uses System.Collections.Generic.List instead of arrays
Lazy initialization of generic collections (on property getters)
Class takes the default namespace of the project
Right click the project and generates all classes for every xsd on the project
Another command bar to generate in vb.net
Generate for a second time if the target file already exist will throw an exception
- Visual Studion 2005 (Whidbey)
- Guidance Automation Extensions (GAX): http://www.microsoft.com/downloads/details.aspx?FamilyId=C0A394C0-5EEB-47C4-9F7B-71E51866A7ED&displaylang=en
Download the MSI and install the GAT package XsdToEntityPackageSetup.zip (202.49 KB)
Remember to enable the package in vs 2005: Tools -> Guidance Package Manager -> Enable/Disable Packages. Choose the one that says â€œGenerates a class from xsdâ€.