Condividi tramite


Generating Code from a Domain-Specific Language

Microsoft Domain-Specific Language Tools provides a powerful way to generate code, documents, configuration files and other artifacts from data represented in models. Using Domain-Specific Language Tools, you can create a set of classes that represent your data, and you can write your text templates in classes whose names and properties reflect that data.

For example, Fabrikam has an XML file of customer names and e-mail addresses. Their developers create a model in which Customer is a class, with properties name and e-mail. They write several text templates to process the data, including this fragment which produces a table of all the customers as part of an HTML page: