<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: How to use T4 to generate Decorator classes</title>
	<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/</link>
	<description>Interfaces are like alcohol - they are a lot of fun when used in moderation.</description>
	<pubDate>Sat, 04 Feb 2012 05:38:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Shankar Thanushkodi</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-3479</link>
		<dc:creator>Shankar Thanushkodi</dc:creator>
		<pubDate>Thu, 15 Dec 2011 14:34:45 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-3479</guid>
		<description>Marian,

Is this what you are looking for?
http://www.codeproject.com/KB/codegen/WCFWrapperUsingT4.aspx#</description>
		<content:encoded><![CDATA[<p>Marian,</p>
<p>Is this what you are looking for?<br />
<a href="http://www.codeproject.com/KB/codegen/WCFWrapperUsingT4.aspx#" rel="nofollow">http://www.codeproject.com/KB/codegen/WCFWrapperUsingT4.aspx#</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marian Tines</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-3313</link>
		<dc:creator>Marian Tines</dc:creator>
		<pubDate>Sun, 05 Dec 2010 00:13:49 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-3313</guid>
		<description>Hi,

Is there some nice way how to get around this limitation? "Interface must be already compiled before decorator class can be generated."

I'd like to avoid need to do 2 operations when I change something in interface (compile and rerun template).

I'm thinking about invoking project build somewhere at the beginning of the template. Another approach can be execute template in some way from the  post build action.

Which approach do you think will be better or should I do something completely different?

Thanks in advance for response,
Marian</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Is there some nice way how to get around this limitation? &#8220;Interface must be already compiled before decorator class can be generated.&#8221;</p>
<p>I&#8217;d like to avoid need to do 2 operations when I change something in interface (compile and rerun template).</p>
<p>I&#8217;m thinking about invoking project build somewhere at the beginning of the template. Another approach can be execute template in some way from the  post build action.</p>
<p>Which approach do you think will be better or should I do something completely different?</p>
<p>Thanks in advance for response,<br />
Marian</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rafael Goodman</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-3253</link>
		<dc:creator>Rafael Goodman</dc:creator>
		<pubDate>Thu, 30 Sep 2010 04:30:52 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-3253</guid>
		<description>When using reflection in T4, what are your thoughts about reading the raw bytes of the assembly into memory in order to load and reflect on it. For example:

byte[] bytes = null;
using(FileStream fs = File.OpenRead("foo.dll"))
{
    bytes = new byte[fs.Length];
    fs.Read(bytes, 0, bytes.Length);
}

Assembly assembly = Assembly.ReflectionOnlyLoad(bytes); 


This *seems* to side-step the "locking" issue, but I'd love to get your thoughts on the approach.</description>
		<content:encoded><![CDATA[<p>When using reflection in T4, what are your thoughts about reading the raw bytes of the assembly into memory in order to load and reflect on it. For example:</p>
<p>byte[] bytes = null;<br />
using(FileStream fs = File.OpenRead(&#8221;foo.dll&#8221;))<br />
{<br />
    bytes = new byte[fs.Length];<br />
    fs.Read(bytes, 0, bytes.Length);<br />
}</p>
<p>Assembly assembly = Assembly.ReflectionOnlyLoad(bytes); </p>
<p>This *seems* to side-step the &#8220;locking&#8221; issue, but I&#8217;d love to get your thoughts on the approach.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2915</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Thu, 25 Feb 2010 19:53:08 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2915</guid>
		<description>I using your example to generate DTO objects based on a Model assembly.  I loop the Types for a given Namespace (from assembly.GetNamespaceList()) and then loop Members of NodeType.Property for the given TypeNode of NodeType.Class.  It appears the calling Property.GetPropertyInfo() is locking the assembly with reflection.  I don't see how (largely do to a lack of documentation) on how to get the info I need with a PropertyInfo object.  You?</description>
		<content:encoded><![CDATA[<p>I using your example to generate DTO objects based on a Model assembly.  I loop the Types for a given Namespace (from assembly.GetNamespaceList()) and then loop Members of NodeType.Property for the given TypeNode of NodeType.Class.  It appears the calling Property.GetPropertyInfo() is locking the assembly with reflection.  I don&#8217;t see how (largely do to a lack of documentation) on how to get the info I need with a PropertyInfo object.  You?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hexadecimal &#187; Writing rock solid code with Code Contracts</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2895</link>
		<dc:creator>hexadecimal &#187; Writing rock solid code with Code Contracts</dc:creator>
		<pubDate>Fri, 05 Feb 2010 19:33:17 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2895</guid>
		<description>[...] some tinkering, I managed (with the help of Google and the T4 guru Oleg Sych) create a text template that would take in the shared class library housing the interface and code [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] some tinkering, I managed (with the help of Google and the T4 guru Oleg Sych) create a text template that would take in the shared class library housing the interface and code [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2277</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Fri, 25 Sep 2009 14:36:13 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2277</guid>
		<description>I'm not suggesting redistributing it. If FxCop is installed on your build server, I don't see why you would not be allowed to use the dll.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not suggesting redistributing it. If FxCop is installed on your build server, I don&#8217;t see why you would not be allowed to use the dll.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sylvain M.</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2276</link>
		<dc:creator>Sylvain M.</dc:creator>
		<pubDate>Fri, 25 Sep 2009 13:06:46 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-2276</guid>
		<description>Hi, 
You talk about using Microsoft.Cci.dll (Microsoft.FxCop.Sdk) which comes with FxCop 1.36. 
Does the license of FxCop allow to use this library out of FxCop context ?
(we may use it for code generation on a build server...)

Thank you per advance for your response, 
Sylvain.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
You talk about using Microsoft.Cci.dll (Microsoft.FxCop.Sdk) which comes with FxCop 1.36.<br />
Does the license of FxCop allow to use this library out of FxCop context ?<br />
(we may use it for code generation on a build server&#8230;)</p>
<p>Thank you per advance for your response,<br />
Sylvain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-1269</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Wed, 29 Apr 2009 11:29:30 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-1269</guid>
		<description>Yes, you can use CodeModel to read the interface directly from a C# file. &lt;a href="http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration" rel="nofollow"&gt;EnumSqlView&lt;/a&gt; is a code generator built using this approach.</description>
		<content:encoded><![CDATA[<p>Yes, you can use CodeModel to read the interface directly from a C# file. <a href="http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration" rel="nofollow">EnumSqlView</a> is a code generator built using this approach.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Joubert</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-1267</link>
		<dc:creator>Daniel Joubert</dc:creator>
		<pubDate>Wed, 29 Apr 2009 11:22:18 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-1267</guid>
		<description>Thanks for the information you provided.

Is it possible to obtain the intellisense engine to read the properties from an interface?
Your solution requires the assembly to be build which is less desirable</description>
		<content:encoded><![CDATA[<p>Thanks for the information you provided.</p>
<p>Is it possible to obtain the intellisense engine to read the properties from an interface?<br />
Your solution requires the assembly to be build which is less desirable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-1195</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Fri, 13 Mar 2009 16:06:07 +0000</pubDate>
		<guid>http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/#comment-1195</guid>
		<description>I don't remember exactly, only that it didn't match with the GoF definition. It looks good now.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t remember exactly, only that it didn&#8217;t match with the GoF definition. It looks good now.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

