Extracting Metadata - Introducing the Tools for Metadata Extraction
(Page 10 of 22 )
Three tools for metadata extraction are available at the Apress Web site in the Downloads area as follows:
- XSDToFriendlyXML.xslt: An XSLT stylesheet to convert XSD schemas to XML that’s friendly to code generation. This effectively extracts usable metadata from an XSD.
- Database Extraction: A .NET tool to coerce a rich set of metadata from SQL Server. You can modify this tool to extract metadata from any SQL-92 compliant database, such as Oracle.
- XML Merge: A .NET tool that performs an intimate merge to incorporate freeform, external, and reflection-derived (and so on) metadata into a monolithic metadata file.
It’s a bit awkward for you to run these tools until you get the code generation harness in the next chapter. You can use a console application if you want to experiment with them now, or you can wait for the generation harness.
NOTE: Appendix B offers walkthroughs of key parts of the code for the first two tools, and I explain the third later in this chapter. You can use the appendix for a deeper understanding either because you’re most comfortable driving when you know what’s under the hood or because you need to tune the engine—making a change to the tools so they work better in your environment. |
Isolating portions of your application and development processes that are likely to remain static from those where change is likely improves maintainability. Many tasks of metadata, such as finding parent or child keys or translating a data type, will be done many times within your templates, but the algorithms for creating them will remain unchanged until there are fundamental changes in how databases work. By pushing this work into your metadata extraction step, you can do it once and provide the results wherever it’s needed.
TIP: Do as much work as you can upfront for creating metadata friendly to your templates. This maximizes reuse and improves maintainability. Extra time developing your metadata extraction tool makes sense because you’ll use it not only as this project evolves, but also when you move forward to new applications. Most of the issues you’ll encounter are solved in the metadata extraction tool you can download from the Apress Web site.
You can attack metadata extraction at a variety of levels. Imagine a bell curve of all the available metadata with the information you’re most likely to use in the middle. For this book, I stretched out beyond the central section and worked to make this tool applicable to most scenarios. But, I’ve certainly left a lot of blank space at the edges and avoided trying to solve all problems for all people. I wanted to keep these tools and my explanation of them from being excessively complex.
This is from Code Generation in Microsoft .NET, by Kathleen Dollard (Apress, ISBN 1590591372). Check it out at your favorite bookstore today. Buy this book now. |
Next: Understanding XSD’s Role in Code Generation >>
More Database Articles
More By Apress Publishing