<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>George Mathew's Blog</title><link>http://blogs.msdn.com/georgem/default.aspx</link><description>Meta Moments</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Part 1 in continuing series on Modeling API</title><link>http://blogs.msdn.com/georgem/archive/2006/02/08/Part1ModelingAPI.aspx</link><pubDate>Wed, 08 Feb 2006 13:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:528434</guid><dc:creator>georgem</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/georgem/comments/528434.aspx</comments><wfw:commentRss>http://blogs.msdn.com/georgem/commentrss.aspx?PostID=528434</wfw:commentRss><description>&lt;p&gt;&lt;font face=Arial&gt;It's been a while since my last post, and for good reason. The whole team has&amp;nbsp;had their&amp;nbsp;heads down and has been working very hard towards the completion of an internal milestone. Now I get the chance to take&amp;nbsp;a brief breather and tell the world about what we've been so busy doing. &lt;font face=Arial&gt;I can't tell you how proud I am of the work we've done.&lt;/font&gt;&amp;nbsp;Here's a quick list:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;- &lt;a href="/garethj/archive/2006/02/04/AnnounceFebCTP.aspx"&gt;Ship DSL Tools within VSSDK Feb CTP&lt;/a&gt;. &lt;br /&gt;- &lt;a href="/garethj/archive/2005/12/30/dsldocs.aspx"&gt;Release first draft of DSL Tools documentation&lt;/a&gt;. &lt;/font&gt;&lt;font face=Arial&gt;&lt;br /&gt;- Add support for 'port' shapes&lt;br /&gt;- A new and vastly improved model (and associated xml format) for the definition of all aspects of a DSL (domain model, shapes, mappings, etc), and some of the code-generation from this model. &lt;/font&gt;&lt;font face=Arial&gt;&lt;br /&gt;- Clean, domain-specific, and customizable serialization of models. &lt;br /&gt;- And last but not least, vast improvements to the Modeling API.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;I was most directly involved in the work on the Modeling API and code-generation work, and I'm excited to share the details. This post will be the first in a series that will cover these areas (and possibly other areas). Given the breadth of customizations that will be allowed by the upcoming DSL Designer (a designer for the DSL definition), it may not be common to have to use the&amp;nbsp;modeling API. Nevertheless, for advanced customizations, and for understanding what the generated code does,&amp;nbsp;it will be necessary to understand&amp;nbsp;the modeling API.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;Now where shall I start? &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;First of all, there are a bunch of naming changes to make things flow better. Here are a few of the biggest ones.&amp;nbsp;I'll add to the list in future postings:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;"MetaX" --&amp;gt; "DomainX" (Eg, MetaClass becomes DomainClass).&lt;br /&gt;"SubStore" or "MetaModel"&amp;nbsp;--&amp;gt; "DomainModel"&lt;br /&gt;"XAttribute" --&amp;gt; "XProperty" (Eg, MetaAttribute becomes DomainProperty). &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;I'll be using the new names from now on. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;In this post, I'll assume that you have a domain model defined using the new format, and the code for it generated using the new generators (I'll cover these in a later post). &lt;/font&gt;&lt;font face=Arial&gt;Let's look at how to create&amp;nbsp;the Model Store, and create a couple of domain-classes and relationships?:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;To create a store, use one of the following 2 constructors: &lt;font color=#0000ff size=2&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;public&lt;font size=2&gt; Store(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;params&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;Type&lt;/font&gt;&lt;font size=2&gt;[] domainModelTypes)&lt;br /&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;font color=#0000ff size=2&gt;public&lt;/font&gt;&lt;font size=2&gt; Store(&lt;/font&gt;&lt;font color=#008080 size=2&gt;IServiceProvider&lt;/font&gt;&lt;font size=2&gt; serviceProvider, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;params&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;Type&lt;/font&gt;&lt;font size=2&gt;[] domainModelTypes)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;For the domainModelTypes parameter, provide a list of the of&amp;nbsp;your 'DomainModels' (the classes in the generated code that used to be derived from Microsoft.VisualStudio.Modeling.SubStore, but are now derived from Microsoft.VisualStudio.Modeling.DomainModel). The serviceProvider is used by the Store's implementation of IServiceProvider. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;For example, &lt;/font&gt;&lt;/p&gt;&lt;font size=2&gt;&lt;font size=2&gt;&lt;font size=3&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;font color=#008080 size=2&gt;Store&lt;/font&gt;&lt;font size=2&gt; store = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;Store&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font size=2&gt;);&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#008080 size=2&gt;Store&lt;/font&gt;&lt;font size=2&gt; store = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;Store&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;typeof&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font color=#008080 size=2&gt;ActivityDomainModel&lt;/font&gt;&lt;font size=2&gt;));&lt;/font&gt;
&lt;p&gt;&lt;font face=Arial&gt;Multiple domain models can be loaded into the store at once. In the example below, a base domain model and an extended domain model are loaded. When there are dependencies between domain models (as in the example below), the domain models should be specified in dependency-order. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;&lt;font color=#008080&gt;Store&lt;/font&gt; store = &lt;font color=#0000ff&gt;new&lt;/font&gt; &lt;font color=#008080&gt;Store&lt;/font&gt;(&lt;font color=#0000ff&gt;typeof&lt;/font&gt;(&lt;font color=#008080&gt;BaseActivityDomainModel&lt;/font&gt;), &lt;font color=#0000ff&gt;typeof&lt;/font&gt;(&lt;font color=#008080&gt;ExtendedActivityDomainModel&lt;/font&gt;));&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;Domain models can also be loaded into the store after construction. For example,&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color=#008080&gt;Store&lt;/font&gt;&lt;font size=2&gt; store = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;Store&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font size=2&gt;);&lt;br /&gt;store.LoadDomainModels(&lt;font color=#0000ff&gt;typeof&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font color=#008080 size=2&gt;ActivityDomainModel&lt;/font&gt;&lt;font size=2&gt;)&lt;/font&gt;);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;Make sure you call store.Dispose() once you are done with it. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;Let's say you have a domain class called 'Person' and another one called 'Activity' and a domain relationship called 'PersonPerformsActivities' (a relationship from one person to many activities)&amp;nbsp;&amp;nbsp;in your domain model. How would you go about creating instances of these classes and relationships? &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Simple, you just use 'new':&lt;/p&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#008080 size=2&gt;Person&lt;/font&gt;&lt;font size=2&gt; person = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;Person&lt;/font&gt;&lt;font size=2&gt;(store);&lt;br /&gt;&lt;/font&gt;&lt;font color=#008080 size=2&gt;Activity&lt;/font&gt;&lt;font size=2&gt; activity = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;Activity&lt;/font&gt;&lt;font size=2&gt;(store, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;PropertyAssignment&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font color=#008080 size=2&gt;Activity&lt;/font&gt;&lt;font size=2&gt;.NameDomainPropertyId, &lt;/font&gt;&lt;font color=#800000 size=2&gt;"Post On Blog"&lt;/font&gt;&lt;font size=2&gt;));&lt;/font&gt;
&lt;p&gt;&lt;font color=#008000 size=2&gt;// Now to create the link between person and activity, we have a few ways of doing it&lt;br /&gt;&lt;/font&gt;&lt;font size=2&gt;person.Activities.Add(activity);&lt;br /&gt;&lt;/font&gt;&lt;font color=#008000 size=2&gt;// or&lt;br /&gt;&lt;/font&gt;&lt;font size=2&gt;activity.Person = person;&lt;br /&gt;&lt;/font&gt;&lt;font color=#008000 size=2&gt;// or&lt;br /&gt;&lt;/font&gt;&lt;font color=#008080 size=2&gt;PersonPerformsActivities&lt;/font&gt;&lt;font size=2&gt; relationship = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;PersonPerformsActivities&lt;/font&gt;&lt;font size=2&gt;(person, activity);&lt;br /&gt;&lt;/font&gt;&lt;font color=#008000 size=2&gt;// There are a few more varieties of the constructor for more complex cases, but these&lt;br /&gt;&lt;/font&gt;&lt;font color=#008000 size=2&gt;// are the simplest and most common ways to create a link&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;Seems obvious, but you could not do this with the old Modeling API. Using new()&amp;nbsp;would not work. Instead you had to&amp;nbsp;call Activity.CreateActivity(..) or store.ElementDirectory.CreateElement(typeof(Activity)). We still support the reflective mechanism of creating elements (I'll cover that in a different post), but 90% of cases will probably use new(). I think&amp;nbsp;this is&amp;nbsp;a great improvement in the API and I hope you agree. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;I'll stop for now. There is so much to cover, but I'll leave the rest for future posts. As always, comments and feedback are welcome and appreciated. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Arial&gt;Thanks,&lt;br /&gt;-George&lt;/font&gt;&lt;font color=#008000 size=2&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=528434" width="1" height="1"&gt;</description></item><item><title>DSL Tools at Visual Studio Launch Events in India</title><link>http://blogs.msdn.com/georgem/archive/2005/12/07/India.aspx</link><pubDate>Wed, 07 Dec 2005 08:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:500866</guid><dc:creator>georgem</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/georgem/comments/500866.aspx</comments><wfw:commentRss>http://blogs.msdn.com/georgem/commentrss.aspx?PostID=500866</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I'll be in India next week&amp;nbsp;for Visual Studio launch events in 3 cities (itinerary below).&amp;nbsp;If you're interested in DSL Tools and you're in the area, I'll be more than happy to give a presentation/demo and chat about DSL Tools.&amp;nbsp;&amp;nbsp;Please let me know if you want to arrange a meeting, or just come find me at the launch events in Mumbai, Pune, or Chennai. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;My itinerary is as follows:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;Mumbai:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12th night to 13th morning&lt;BR&gt;Pune:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;13th morning to 13th evening&lt;BR&gt;Chennai:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;14th morning to 15th morning&lt;BR&gt;Bangalore: 15th morning to 15th evening&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=500866" width="1" height="1"&gt;</description></item><item><title>DSL Tools November CTP is Live</title><link>http://blogs.msdn.com/georgem/archive/2005/12/05/November-CTP-Available.aspx</link><pubDate>Tue, 06 Dec 2005 00:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:500285</guid><dc:creator>georgem</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/georgem/comments/500285.aspx</comments><wfw:commentRss>http://blogs.msdn.com/georgem/commentrss.aspx?PostID=500285</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;The November CTP of DSL Tools is now available for download at &lt;A href="http://msdn.microsoft.com/vstudio/teamsystem/workshop/DSLTools/default.aspx"&gt;http://msdn.microsoft.com/vstudio/teamsystem/workshop/DSLTools/default.aspx&lt;/A&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;. New features in this release include:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;- A validation framework for validating the model on save, open, using a menu item, and at other custom points. &lt;BR&gt;- The ability to add a DSL Setup project to your DSL solution that builds a deployable MSI for your designer.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;These features are explained better in Stuart's post &lt;a href="https://blogs.msdn.com:443/stuart_kent/archive/2005/11/02/488101.aspx"&gt;here&lt;/A&gt;. The release also includes some bug fixes. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Try it out, and let us know what you think. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Thanks,&lt;BR&gt;-George&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=500285" width="1" height="1"&gt;</description></item><item><title>Text Templating Improvements</title><link>http://blogs.msdn.com/georgem/archive/2005/12/05/New-T4-Features.aspx</link><pubDate>Mon, 05 Dec 2005 13:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:500044</guid><dc:creator>georgem</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/georgem/comments/500044.aspx</comments><wfw:commentRss>http://blogs.msdn.com/georgem/commentrss.aspx?PostID=500044</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Gareth posted an &lt;A href="https://blogs.msdn.com/garethj/archive/2005/06/01/T4Syntax.aspx"&gt;entry&lt;/A&gt; in June (with links to previous postings on the same subject) about Text Templating code generation engine. Pleas refert to it for background information.&amp;nbsp;After hearing feedback from customers and from our own use of the feature, we recently made some improvements to it&amp;nbsp;that we hope you'll like. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Previously, if you wanted to append to the output text from within a method in a class-feature block, you would have to use clumsy Write() and WriteLine() statements. For example:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;# PrintPowersOfTwo(1,5); #&amp;gt;&lt;BR&gt;&amp;lt;#+&lt;BR&gt;private void PrintPowersOfTwo(int i, int j)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(;i&amp;lt;j;i++)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WriteLine("2 to the power {0} is:", i);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WriteLine(Math.Pow(2,i).ToString());&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;BR&gt;#&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;This could get clumsy quickly, especially if you have methods that output large amounts of text. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;To help the situation, we added a&amp;nbsp;new&amp;nbsp;feature to allow boilerplate and expression blocks to be embedded within class-feature blocks. For example, the same PrintPowersOfTwo() function above could look like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;#+&lt;BR&gt;private void PrintPowersOfTwo(int i, int j)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(;i&amp;lt;j;i++)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;#&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;2 to the power &amp;lt;#= i #&amp;gt; is:&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;&amp;lt;#= Math.Pow(2,i) #&amp;gt;&lt;BR&gt;&lt;/STRONG&gt;&amp;lt;#+&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;BR&gt;#&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;We feel this helps conform better to the users instinctive expectation of what the above template should do. It is a very natural way to use class-feature blocks to spit up code-generation into different methods. I've used it myself for some of my code-generation tasks and find it tremendously useful, and I hope you find the same. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;With this change, no statement blocks will be allowed after the first class-feature block within a file. And all boilerplate or expression blocks found after the first class-feature block will be treated as embedded within the class-feature. So doing something like this will cause a compiler error:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;#+&lt;BR&gt;private void DoNothing() {}&lt;BR&gt;#&amp;gt;&lt;BR&gt;boilerplate text&lt;BR&gt;&amp;lt;#+&lt;BR&gt;private void DoNothingAgain() {}&lt;BR&gt;#&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The restrictions above don't affect the code-generation functionality of Text Templates in any way, however. And as I mentioned earlier, the outcome does feel more natural once you've tried it. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Another feature we've added, that goes hand in hand with the above feature, is three methods and one property in the base code-generation class to manage indents:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;public void PushIndent(string indent);&lt;BR&gt;public&amp;nbsp;string PopIndent();&lt;BR&gt;public void ClearIndent();&lt;BR&gt;public string CurrentIndent { get; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;PushIndent adds the provided indent to the current indent. PopIndent removes the previously indend added through PushIndent, and does nothing if there is no indent. ClearIndent clears the current indent. And CurrentIndent gets the current indent string. The current indent is applied after every newline that is ouput (even if it's output using the Write() or WriteLine() functions). For example, using the PrintPowersOfTwo() function provided earlier:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;#&lt;BR&gt;PrintPowersOfTwo(1,3);&lt;BR&gt;PushIndent("&amp;nbsp;&amp;nbsp;&amp;nbsp; ");&lt;BR&gt;PrintPowersOfTwo(4,6);&lt;BR&gt;PushIndent("indent&amp;gt;");&lt;BR&gt;PrintPowersOfTwo(7,9);&lt;BR&gt;PopIndent();&lt;BR&gt;WriteLine("Test Indent");&lt;BR&gt;WriteLine("Current Indent is \""+CurrentIndent+"\"");&lt;BR&gt;ClearIndent();&lt;BR&gt;#&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Produces the following output:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;2 to the power 1 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;is&lt;/FONT&gt;&lt;FONT size=2&gt;:&lt;BR&gt;2&lt;BR&gt;2 to the power 2 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;is&lt;/FONT&gt;&lt;FONT size=2&gt;:&lt;BR&gt;4&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 to the power 4 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;is&lt;/FONT&gt;&lt;FONT size=2&gt;:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 to the power 5 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;is&lt;/FONT&gt;&lt;FONT size=2&gt;:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; indent&amp;gt;2 to the power 7 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;is&lt;/FONT&gt;&lt;FONT size=2&gt;:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; indent&amp;gt;128&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; indent&amp;gt;2 to the power 8 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;is&lt;/FONT&gt;&lt;FONT size=2&gt;:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; indent&amp;gt;256&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test Indent&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Current Indent &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;is&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;" "&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800000 size=2&gt;&lt;FONT face=Arial color=#000000&gt;I hope you like these improvements.&amp;nbsp;&lt;FONT color=#800000 size=2&gt;&lt;FONT face=Arial color=#000000&gt;Any comments, suggestions, or other feedback would be very much appreciated. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Unfortunately, this will not be in the November CTP, and I don't know the&amp;nbsp;exact dates for our next release. Sorry to get you all excited and then tell you you can't have it yet. But&amp;nbsp;it is worth the wait :). And this gives us a chance to gather some&amp;nbsp;early feedback on the feature (so please spill your thoughts).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800000 size=2&gt;&lt;FONT face=Arial color=#000000&gt;Thanks,&lt;BR&gt;George &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=500044" width="1" height="1"&gt;</description></item><item><title>Hello!</title><link>http://blogs.msdn.com/georgem/archive/2005/12/03/George.aspx</link><pubDate>Sat, 03 Dec 2005 07:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:499674</guid><dc:creator>georgem</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/georgem/comments/499674.aspx</comments><wfw:commentRss>http://blogs.msdn.com/georgem/commentrss.aspx?PostID=499674</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;I am a software developer in the&lt;A href="http://msdn.microsoft.com/teamsystem"&gt; Visual Studio Team System &lt;/A&gt;group, specifically in the &lt;A href="http://msdn.microsoft.com/vstudio/teamsystem/workshop/DSLTools/"&gt;DSL Tools&lt;/A&gt; team, which is a framework for building graphical designers for Domain Specific Languages. For Visual Studio 2005, I worked on the much loved &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/clssdsgnr.asp"&gt;Class Designer&lt;/A&gt;. In the &lt;A href="http://msdn.microsoft.com/vstudio/teamsystem/workshop/DSLTools/"&gt;DSL Tools&lt;/A&gt;&amp;nbsp;team, I work mainly on the modeling data store infrastructure (which we fondly call the IMS), and on the the Text Templating code generation infrastructure (which we call T4 because it rolls off the tongue better).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I started this blog to follow the lead of other great bloggers from my team (&lt;/FONT&gt;&lt;A id=_ctl0__ctl0__ctl0__ctl0_BlogSideBar1__ctl0_Linkcategorylist1__ctl0_Categories__ctl1_Links__ctl2_Link href="/garethj/"&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;Gareth Jones&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;, &lt;/FONT&gt;&lt;A id=_ctl0__ctl0__ctl0__ctl0_BlogSideBar1__ctl0_Linkcategorylist1__ctl0_Categories__ctl1_Links__ctl4_Link href="/stevecook/"&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;Steve Cook&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;, &lt;/FONT&gt;&lt;A id=_ctl0__ctl0__ctl0__ctl0_BlogSideBar1__ctl0_Linkcategorylist1__ctl0_Categories__ctl1_Links__ctl5_Link href="/stuart_kent/"&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;Stuart Kent&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;, &lt;/FONT&gt;&lt;A id=_ctl0__ctl0__ctl0__ctl0_BlogSideBar1__ctl0_Linkcategorylist1__ctl0_Categories__ctl1_Links__ctl3_Link href="/pedrosilva/"&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;Pedro Silva&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;, &lt;/FONT&gt;&lt;A id=_ctl0__ctl0__ctl0__ctl0_Linkcategorylist1__ctl0_Categories__ctl1_Links__ctl4_Link href="/jochens"&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;Jochen Seemann&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;, &lt;/FONT&gt;&lt;A id=_ctl0__ctl0__ctl0__ctl0_BlogSideBar1__ctl0_Linkcategorylist1__ctl0_Categories__ctl1_Links__ctl6_Link href="/jackgr/"&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;Jack Greenfield&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;etc&lt;FONT face=Arial size=2&gt;) and from Microsoft in general, who have used blogs as a very effective means of communicating with our customers. I hope to use this as a means of gathering feedback for design decisions and the product in general, sharing interesting news and information about DSL Tools and Model-Driven-Development. I will also be using this as a spot for collecting ramblings about various other technical fields that interest me.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Hope you enjoy the read. It goes without saying that any comments and feedback are welcome and appreciated.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Thanks,&lt;BR&gt;George Mathew&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=499674" width="1" height="1"&gt;</description></item></channel></rss>