Getting Started With DSL Tools - Part II

I decided to install the August CTP for the Visual Studio 2008 SDK since I have been working solely in VS 2008 recently.  Installation was quick and painless; I was able to create a new minimal language template that functions without any magic incantations.  The only problem I ran into was, while following along with Stuart’s Channel9 interview using the Visual Studio 2008 SDK, I get a COM exception when I right-click on the DSL Explorer pane:

 Error HRESULT E_FAIL has been returned from a COM component

Gareth Jones was kind enough to reply (on a Saturday, no doubt!) to let me know this is a known issue.  The fix is to run at the Visual Studio Command Shell:

 devenv /setup

I have been reading Domain-Specific Development with Visual Studio DSL Tools and I just didn't have the aha moment that I was hoping for.  Then I watched Stuart’s Channel9 interview, and the lightbulb went off.  I started creating my own model, and actually had the thing working (more or less).  I finally get the relationship of the domain model to the shapes, how to express cardinality, and I get visual filtering.  What I don't quite get yet is where I write my code and where I affect the text templates. 

The things I am still struggling with conceptually are really interms of where I put my code and where do I generate my artifacts.  The DSLs that I am thinking of are really for code generation, so I am trying to figure out how to perform a fairly specific task.  For instance, in the Family Tree DSL Tools sample, you use a partial class decorated with attributes in the "Dsl" project (the root project that describes the domain and class shapes) to provide validation.  Contrast that to the Text Templating Directive Processor sample, I am not sure how to merge these 2 very different approaches together yet.

There are a number of other DSL Tools samples that I haven't gone through yet, either.  Maybe as I continue to work through them I will find the enlightenment that I seek.