<?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>Using T4 Templates with GDR Database Projects</title><link>http://blogs.msdn.com/psirr/archive/2008/12/29/using-t4-templates-with-gdr-database-projects.aspx</link><description>For this blog I’ve developed an add-in for General Distribution Release (GDR) for Visual Studio Team System 2008 Database Edition projects (better known as “Data Dude”) which will generate Create, Read, Update and Delete (CRUD) stored procedures for a</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Using T4 Templates with GDR Database Projects</title><link>http://blogs.msdn.com/psirr/archive/2008/12/29/using-t4-templates-with-gdr-database-projects.aspx#9360958</link><pubDate>Thu, 22 Jan 2009 04:08:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9360958</guid><dc:creator>amselem</dc:creator><description>&lt;p&gt;When accessing an ISqlProcedure element, I can enumerate all dependant columns (proc.BodyDependencies), but if I have two or more resultsets then I get a flat enumeration of both resultset 1 columns + resultset 2 columns.&lt;/p&gt;
&lt;p&gt;How could I get the resultset index belonging to a given column?&lt;/p&gt;
</description></item><item><title>re: Using T4 Templates with GDR Database Projects</title><link>http://blogs.msdn.com/psirr/archive/2008/12/29/using-t4-templates-with-gdr-database-projects.aspx#9362663</link><pubDate>Thu, 22 Jan 2009 07:27:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9362663</guid><dc:creator>Gokhan Caglar - MSFT</dc:creator><description>&lt;p&gt;The relationships between elements are mostly meant for dependencies. &amp;nbsp;So you can't get what you're asking consistently. &amp;nbsp;For example, if the same column is referred to twice from a proc, we collapse, and you'll only have one column reference.&lt;/p&gt;
&lt;p&gt;You might want to get the AST of the proc body and walk that instead. &amp;nbsp;You'd have to walk the statement list until you find the select statement you're looking for.&lt;/p&gt;
</description></item><item><title>re: Using T4 Templates with GDR Database Projects</title><link>http://blogs.msdn.com/psirr/archive/2008/12/29/using-t4-templates-with-gdr-database-projects.aspx#9369215</link><pubDate>Thu, 22 Jan 2009 19:55:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9369215</guid><dc:creator>psirr</dc:creator><description>&lt;p&gt;The following I copied from an email by Liangxiao Zhu:&lt;/p&gt;
&lt;p&gt;On the relationshipentry, we have a list of RelationshipEntrySource. &amp;nbsp;From that you can get a position for each column, even if they are collapsed, you can still get the RelationshipEntrySource for each select column. &amp;nbsp;But if you want to know what column belongs to which select statement, as Gokhan said, you need to walk the AST tree, at least get the position range of the statement and then get the select columns with position inside the range.&lt;/p&gt;
&lt;p&gt;Following is the sample line of getting the relationship entry source. &amp;nbsp;On it, you can get startoffset, length, script and IScriptFragment.&lt;/p&gt;
&lt;p&gt;IList&amp;lt;RelationshipEntrySource&amp;gt; relationshipEntrySources = relatingElement.GetRelationshipEntrySources(entry);&lt;/p&gt;
</description></item><item><title>re: Using T4 Templates with GDR Database Projects</title><link>http://blogs.msdn.com/psirr/archive/2008/12/29/using-t4-templates-with-gdr-database-projects.aspx#9374504</link><pubDate>Sun, 25 Jan 2009 05:08:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9374504</guid><dc:creator>amselem</dc:creator><description>&lt;p&gt;Thanks a lot for your suggestions but I'm still struggling how to get the resulting schema of a procedure. I'd like to code gen a DAL from db project objects, but things get worse when analyzing multi-statement procs with calculated columns. Parsing the AST solves some cases but the solving the complicated ones looks like hard to me.&lt;/p&gt;
&lt;p&gt;What I'm looking is some way to &amp;quot;SET FMTONLY ON&amp;quot; and then execute the proc to get its metadata, but since there is no more underlying DB I think that it won't be possible. Any other suggestions would be appreciated, thanks!&lt;/p&gt;
</description></item><item><title>re: Using T4 Templates with GDR Database Projects</title><link>http://blogs.msdn.com/psirr/archive/2008/12/29/using-t4-templates-with-gdr-database-projects.aspx#9375194</link><pubDate>Sun, 25 Jan 2009 22:20:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9375194</guid><dc:creator>Gokhan Caglar - MSFT</dc:creator><description>&lt;p&gt;For complex select statements, it may be hard for you to analyze the Ast yourself. &amp;nbsp;You can try to create a view for these complex ones (Temp tables may be a problem still) and walk the columns of the view.&lt;/p&gt;
</description></item></channel></rss>