<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alex Medina &#187; LINQ</title>
	<atom:link href="http://alexmedina.net/blog/tag/linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexmedina.net/blog</link>
	<description>Mi blog, mis cosas...</description>
	<lastBuildDate>Tue, 22 Jun 2010 08:23:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linq to SQL Debug Visualizer, depura facilmente tus consultas LINQ to SQL</title>
		<link>http://alexmedina.net/blog/2009/07/01/linq-to-sql-debug-visualizer-depura-facilmente-tus-consultas-linq-to-sql/</link>
		<comments>http://alexmedina.net/blog/2009/07/01/linq-to-sql-debug-visualizer-depura-facilmente-tus-consultas-linq-to-sql/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 17:18:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[depurar]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://alexmedina.net/blog/2009/07/01/linq-to-sql-debug-visualizer-depura-facilmente-tus-consultas-linq-to-sql/</guid>
		<description><![CDATA[Using the LINQ to SQL Debug Visualizer
 One of the nice development features that LINQ to SQL supports is the ability to use a &#8220;debug visualizer&#8221; to hover over a LINQ expression while in the VS 2008 debugger and inspect the raw SQL that the ORM will ultimately execute at runtime when evaluating the LINQ query [...]]]></description>
			<content:encoded><![CDATA[<h3><font face="arial" size="2"><u>Using the LINQ to SQL Debug Visualizer</u></font></h3>
<p><font face="arial" size="2"> </font><font face="arial" size="2">One of the nice development features that LINQ to SQL supports is the ability to use a &#8220;debug visualizer&#8221; to hover over a LINQ expression while in the VS 2008 debugger and inspect the raw SQL that the ORM will ultimately execute at runtime when evaluating the LINQ query expression.</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">For example, assume we write the below LINQ query expression code against a set of data model classes:</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2"><img src="http://www.scottgu.com/blogposts/linqtosql3/step3.jpg" /> </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">We could then use the VS 2008 debugger to hover over the &#8220;products&#8221; variable after the query expression has been assigned:</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2"><img src="http://www.scottgu.com/blogposts/linqtosql3/step4.jpg" /> </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">And if we click the small magnifying glass in the expression above, we can launch the LINQ to SQL debug visualizer to inspect the raw SQL that the ORM will execute based on that LINQ query:</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2"><img src="http://www.scottgu.com/blogposts/linqtosql3/step5.jpg" /> </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">If you click the &#8220;Execute&#8221; button, you can even test out the SQL query and see the raw returned results that will be returned from the database:</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2"><img src="http://www.scottgu.com/blogposts/linqtosql3/step6.jpg" /> </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">This obviously makes it super easy to see precisely what SQL query logic LINQ to SQL ORM is doing for you.  </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">You can learn even more about how all this works by reading the <a href="http://weblogs.asp.net/scottgu/archive/2007/06/29/linq-to-sql-part-3-querying-our-database.aspx" target="_blank">Part 3: Querying our Database</a> segment in my LINQ to SQL series above.</font></p>
<p><font face="arial" size="2"> </font></p>
<h3><font face="arial" size="2"><u>How to Install the LINQ to SQL Debug Visualizer</u></font></h3>
<p><font face="arial" size="2"> </font><font face="arial" size="2">The LINQ to SQL Debug Visualizer isn&#8217;t built-in to VS 2008 &#8211; instead it is an add-in that you need to download to use.  You can download a copy of it <a href="http://www.scottgu.com/blogposts/linqquery/SqlServerQueryVisualizer.zip" target="_blank">here</a>.</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">The download contains both a binary .dll assembly version of the visualizer (within the \bin\debug directory below), as well as all of the source code for the visualizer:</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2"><img src="http://www.scottgu.com/blogposts/linqquery/linq1.jpg" /> </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">To install the LINQ to SQL debug visualizer, follow the below steps:</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">1) Shutdown all running versions of Visual Studio 2008 </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">2) Copy the <strong>SqlServerQueryVisualizer.dll</strong> assembly from the <strong>\bin\debug\</strong> directory in the .zip download above into your local <strong>\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers\</strong> directory:</font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2"><img src="http://www.scottgu.com/blogposts/linqquery/linq2.jpg" /> </font></p>
<p><font face="arial" size="2"> </font><font face="arial" size="2">3) Start up Visual Studio 2008 again.  Now when you use the debugger with LINQ to SQL you should be able to hover over LINQ query expressions and inspect their raw SQL (no extra registration is required).</font></p>
]]></content:encoded>
			<wfw:commentRss>http://alexmedina.net/blog/2009/07/01/linq-to-sql-debug-visualizer-depura-facilmente-tus-consultas-linq-to-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
