Generate from VS 2010 Ultimate UML Diagrams - Updated for RTM

I got a lot of feedback regarding my UML Code Generation Blog post. Now i am updating this one. I am using the latest T4 Editor V1.9 from the VS Gallery which gives me IntelliSense and XML Comment Tooltips in the PRO Version which is really helpful to navigate the UML Object Model.

image

I wanted to update the code so here it is for RTM

<#@ template language="C#" debug="true" hostSpecific="true" #>
<#@ assembly name="$(DevEnvDir)\PublicAssemblies\Microsoft.VisualStudio.Uml.Interfaces.dll"#>
<#@ assembly name="$(DevEnvDir)\PublicAssemblies\Microsoft.VisualStudio.ArchitectureTools.Extensibility.dll"#>
<#@ assembly name="System.Core.dll"#>
<#@ import namespace="System.Linq" #>
<#@ import namespace="Microsoft.VisualStudio.Uml.Classes" #>
<#@ import namespace="Microsoft.VisualStudio.ArchitectureTools.Extensibility" #>
<#@ import namespace="Microsoft.VisualStudio.ArchitectureTools.Extensibility.Uml" #>
<#   

string projectPath = System.IO.Path.GetDirectoryName(this.Host.TemplateFile)
+ @"\..\ModelingProject1\ModelingProject1.modelproj";
using (IModelingProjectReader project = ModelingProject.LoadReadOnly(projectPath))
{
IModelStore store = project.Store;
foreach (IClass classElement in store.AllInstances<IClass>())
{
#>

        class <#= classElement.NAName #> {
           // Hello World!

<#
foreach (IProperty p in classElement.OwnedAttributes){
var PropertyTypename = "object";
if (p.Type !=null) PropertyTypename= p.Type.Name;
#>
            public <#=PropertyTypename#> <#=p.Name#> {set;get;}
<#
}
#>

        }
       <#
}
}
#>