<?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: T4 template for generating SQL view from C# enumeration</title>
	<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/</link>
	<description>Me.Write(code)</description>
	<pubDate>Fri, 12 Mar 2010 19:37:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-2649</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Sun, 27 Dec 2009 21:26:36 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-2649</guid>
		<description>Brandon, GetEnum method is defined in the code generation template itself.</description>
		<content:encoded><![CDATA[<p>Brandon, GetEnum method is defined in the code generation template itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon</title>
		<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-2571</link>
		<dc:creator>Brandon</dc:creator>
		<pubDate>Sat, 19 Dec 2009 14:31:57 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-2571</guid>
		<description>What namespace is GetEnum() in? I can't seem to find it either in EnvDTE or google</description>
		<content:encoded><![CDATA[<p>What namespace is GetEnum() in? I can&#8217;t seem to find it either in EnvDTE or google</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-1530</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Tue, 23 Jun 2009 20:16:45 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-1530</guid>
		<description>I've done something similar to this - I got around the DB project problem by adding my table definition (id &#38; name) to the DB project, and using the generated SQL (re)populate it with the correct data.

The generated SQL can then be included in a DB project's post deployment script using something like

:r "..\ProjectWithT4\GeneratedEnums.sql"

I'm also using T4 to generate both my SQL and enum definition (.NET) code. With your method, I believe the SQL is not regenerated unless the template file is touched - this way a change causes both to be regenerated.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve done something similar to this - I got around the DB project problem by adding my table definition (id &amp; name) to the DB project, and using the generated SQL (re)populate it with the correct data.</p>
<p>The generated SQL can then be included in a DB project&#8217;s post deployment script using something like</p>
<p>:r &#8220;..\ProjectWithT4\GeneratedEnums.sql&#8221;</p>
<p>I&#8217;m also using T4 to generate both my SQL and enum definition (.NET) code. With your method, I believe the SQL is not regenerated unless the template file is touched - this way a change causes both to be regenerated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony Bouch</title>
		<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-1037</link>
		<dc:creator>Anthony Bouch</dc:creator>
		<pubDate>Tue, 27 Jan 2009 00:43:59 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-1037</guid>
		<description>Would be great to have a template that creates an SQL view from the descriptor pattern as well as an enumeration.

http://www.devx.com/enterprise/Article/28246/0/page/3

http://www.58bits.com/blog/2008/06/30/AUIAndCultureFriendlyReplacementForEnumerationTypes.aspx</description>
		<content:encoded><![CDATA[<p>Would be great to have a template that creates an SQL view from the descriptor pattern as well as an enumeration.</p>
<p><a href="http://www.devx.com/enterprise/Article/28246/0/page/3" rel="nofollow">http://www.devx.com/enterprise/Article/28246/0/page/3</a></p>
<p><a href="http://www.58bits.com/blog/2008/06/30/AUIAndCultureFriendlyReplacementForEnumerationTypes.aspx" rel="nofollow">http://www.58bits.com/blog/2008/06/30/AUIAndCultureFriendlyReplacementForEnumerationTypes.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-588</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Wed, 15 Oct 2008 17:40:16 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-588</guid>
		<description>I agree that adding a ContactType table and a foreign key to help enforcing values in the Type column of the Contact table is a good idea. However, it doesn't help you to write T-SQL code that needs to use a particular ContactType value. Consider having the following code in a stored procedure:

select * from Contact
where Type = (select Id from ContactType where Name = "Organization")

If the name of the "Organization" contact type changes to "Company", this code will start failing silently by returning 0 rows. You could solve this problem by changing the code to look like this:

select * from Contact
where Type = 1

But this requires you to know that 1 means "Organization". Aside from making this code difficult to read, if the meaning of contact type 1 changes to "Individual", this code will also fail silently.</description>
		<content:encoded><![CDATA[<p>I agree that adding a ContactType table and a foreign key to help enforcing values in the Type column of the Contact table is a good idea. However, it doesn&#8217;t help you to write T-SQL code that needs to use a particular ContactType value. Consider having the following code in a stored procedure:</p>
<p>select * from Contact<br />
where Type = (select Id from ContactType where Name = &#8220;Organization&#8221;)</p>
<p>If the name of the &#8220;Organization&#8221; contact type changes to &#8220;Company&#8221;, this code will start failing silently by returning 0 rows. You could solve this problem by changing the code to look like this:</p>
<p>select * from Contact<br />
where Type = 1</p>
<p>But this requires you to know that 1 means &#8220;Organization&#8221;. Aside from making this code difficult to read, if the meaning of contact type 1 changes to &#8220;Individual&#8221;, this code will also fail silently.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin Taylor</title>
		<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-585</link>
		<dc:creator>Justin Taylor</dc:creator>
		<pubDate>Wed, 15 Oct 2008 01:11:18 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-585</guid>
		<description>Why wouldn't you have a ContactType table that had a foreign key from Contact which stored all your id's against names? Surely this would be better practice in terms of optimising the database and it allows you to change th names of the the Contact types without affecting your stored procedures?</description>
		<content:encoded><![CDATA[<p>Why wouldn&#8217;t you have a ContactType table that had a foreign key from Contact which stored all your id&#8217;s against names? Surely this would be better practice in terms of optimising the database and it allows you to change th names of the the Contact types without affecting your stored procedures?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Odell</title>
		<link>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-254</link>
		<dc:creator>Jeff Odell</dc:creator>
		<pubDate>Mon, 14 Jul 2008 23:50:41 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/#comment-254</guid>
		<description>Swwet - a great solution to a problem we know and love.</description>
		<content:encoded><![CDATA[<p>Swwet - a great solution to a problem we know and love.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
