<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Chris Cavanagh&#039;s Blog</title>
	<atom:link href="http://chriscavanagh.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chriscavanagh.wordpress.com</link>
	<description>.NET, WPF, Silverlight, iOS and many other cool things</description>
	<lastBuildDate>Fri, 20 Jan 2012 06:58:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='chriscavanagh.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Chris Cavanagh&#039;s Blog</title>
		<link>http://chriscavanagh.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://chriscavanagh.wordpress.com/osd.xml" title="Chris Cavanagh&#039;s Blog" />
	<atom:link rel='hub' href='http://chriscavanagh.wordpress.com/?pushpress=hub'/>
		<item>
		<title>H4 Visas and Employment</title>
		<link>http://chriscavanagh.wordpress.com/2011/09/22/h4-visas-and-employment/</link>
		<comments>http://chriscavanagh.wordpress.com/2011/09/22/h4-visas-and-employment/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 14:18:08 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[Immigration]]></category>
		<category><![CDATA[Politics]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2011/09/22/h4-visas-and-employment/</guid>
		<description><![CDATA[UPDATE: There are other petitions covering similar topics, with many more votes so far.  I’ve added them to the end of this post… If you live in the US, please take a look at this petition to allow H4 visa holders (spouses etc who are wholly dependent on other visa holders, like H1’s – which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=668&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE</strong>: There are other petitions covering similar topics, with many more votes so far.  I’ve added them to the end of this post…</p>
<p>If you live in the US, please take a look at this petition to allow H4 visa holders (spouses etc who are wholly dependent on other visa holders, like H1’s – which companies like Microsoft benefit from) to seek employment:</p>
<p><a title="http://wh.gov/gDr" href="http://wh.gov/gDr">http://wh.gov/gDr</a></p>
<p>It’s on the new “We the People” page on the White House site…  Pretty cool, although interesting to see <a title="Legalize and Regulate Marijuana in a Manner Similar to Alcohol" href="https://wwws.whitehouse.gov/petitions#!/petition/legalize-and-regulate-marijuana-manner-similar-alcohol/y8l45gb1" target="_blank">legalizing marijuana</a> and acknowledging an <a title="WTF #2" href="https://wwws.whitehouse.gov/petitions#!/petition/formally-acknowledge-extraterrestrial-presence-engaging-human-race-disclosure/wfYDlmlG" target="_blank">“extra terrestrial presence engaging the human race”</a> are considered such major priorities <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style:none;" src="http://chriscavanagh.files.wordpress.com/2011/09/wlemoticon-winkingsmile.png?w=490" alt="Winking smile" /></p>
<p>Thanks!</p>
<p>&#8212;</p>
<p>Other similar petitions:</p>
<ul>
<li><a title="Allow Seriously Backlogged EB2/EB3 Beneficiaries with Their I-140 Approved to File I-485 and Apply for EAD &amp; AP" href="https://wwws.whitehouse.gov/petitions#!/petition/allow-seriously-backlogged-eb2eb3-beneficiaries-their-i-140-approved-file-i-485-and-apply-ead-ap/d3D62yTt" target="_blank">Allow Seriously Backlogged EB2/EB3 Beneficiaries with Their I-140 Approved to File I-485 and Apply for EAD &amp; AP</a> (although suggests it’s only an issue for certain countries of origin; in reality it’s anyone who’s on EB3, but certainly worse for “oversubscribed” countries).</li>
<li><a title="Legal Employment-based Immigration Petitioners Help U.S. Companies and Should NOT be Heavily Backlogged for Years" href="https://wwws.whitehouse.gov/petitions/%21/petition/legal-employment-based-immigration-petitioners-help-us-companies-and-should-not-be-heavily/1NLS8G5c" target="_blank">Legal Employment-based Immigration Petitioners Help U.S. Companies and Should NOT be Heavily Backlogged for Years</a></li>
<li><a title="Allow H-4 Visa member to work legally" href="https://wwws.whitehouse.gov/petitions#!/petition/allow-h-4-visa-member-work-legally/N7wKxBpN" target="_blank">Allow H-4 Visa member to work legally</a></li>
</ul>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2011/09/22/h4-visas-and-employment/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/09/22/h4-visas-and-employment/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/" /></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/668/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=668&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2011/09/22/h4-visas-and-employment/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2011/09/wlemoticon-winkingsmile.png" medium="image">
			<media:title type="html">Winking smile</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/09/22/h4-visas-and-employment/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>Awesomium &#8211; Free Indie License!</title>
		<link>http://chriscavanagh.wordpress.com/2011/05/11/awesomium-free-indie-license/</link>
		<comments>http://chriscavanagh.wordpress.com/2011/05/11/awesomium-free-indie-license/#comments</comments>
		<pubDate>Wed, 11 May 2011 18:16:27 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2011/05/11/awesomium-free-indie-license/</guid>
		<description><![CDATA[Awesomium v1.6 is finally out, with a very awesome free license for indie developers.&#160; It includes AwesomiumSharp, which means you cam do all kinds of cool and crazy .NET stuff with it Go get it here! (or at http://awesomium.com).<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=633&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Awesomium v1.6 is finally out, with a very awesome free license for indie developers.&#160; It includes AwesomiumSharp, which means you cam do all kinds of cool and crazy .NET stuff with it <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://chriscavanagh.files.wordpress.com/2011/05/wlemoticon-smile.png?w=490" /></p>
<p>Go get it <a href="http://awesomium.com/?utm_source=Awesomium+News&amp;utm_campaign=8ad16e6c82-6_Reasons_Youll_Love_Awesomium_1_6_Email&amp;utm_medium=email" target="_blank">here</a>! (or at <a href="http://awesomium.com" target="_blank">http://awesomium.com</a>).</p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2011/05/11/awesomium-free-indie-license/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/05/11/awesomium-free-indie-license/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/633/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=633&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2011/05/11/awesomium-free-indie-license/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2011/05/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/05/11/awesomium-free-indie-license/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Xquery with LINQ To SQL</title>
		<link>http://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/</link>
		<comments>http://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 00:30:26 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/</guid>
		<description><![CDATA[UPDATE – Beefed up the regular expression for better handling of nested parentheses. LINQ To SQL doesn’t provide a way to include Xquery expressions in queries.&#160; The simplest solution is to create SQL user-defined functions that perform the Xquery for you and return scalar results. This works pretty well for small databases, but you lose [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=617&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE</strong> – Beefed up the regular expression for better handling of nested parentheses.</p>
<p>LINQ To SQL doesn’t provide a way to include Xquery expressions in queries.&#160; The simplest solution is to create SQL user-defined functions that perform the Xquery for you and return scalar results.</p>
<p>This works pretty well for small databases, but you lose the benefit of SQL Server’s XML indexes.&#160; To get around that, we can modify the SQL command text to expand the function calls into raw Xquery expressions.</p>
<p>There are a couple of ways to do this, depending on the complexity / flexibility required for your query.&#160; For simple queries you can use the <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getcommand.aspx" target="_blank">DataContext.GetCommand</a> method, modify the command, and get the results through <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.translate.aspx" target="_blank">DataContext.Translate</a> or <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executequery.aspx" target="_blank">DataContext.ExecuteQuery</a>.&#160; For complex queries (particularly ones that need to shape the results) you’ll need to jump through a <a href="http://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/" target="_blank">couple of Reflection hoops</a>.</p>
<p>Since we don’t actually need to call the SQL user-defined functions, we can just create empty placeholders.&#160; Here’s a sample table and functions:</p>
<pre class="code"><span style="color:green;">-- =============================================
-- Author:      Chris Cavanagh
-- Create date: 3/15/2011
-- Description: Demo table
-- =============================================
</span><span style="color:blue;">CREATE TABLE </span>[dbo]<span style="color:gray;">.</span>[MyXmlFieldTable]<span style="color:gray;">(
    </span>[UID] [uniqueidentifier] <span style="color:gray;">NOT NULL,
    </span>[TimeCreated] [datetime] <span style="color:gray;">NOT NULL,
    </span>[XmlValues] [xml] <span style="color:gray;">NULL,
 </span><span style="color:blue;">CONSTRAINT </span>[PK_MyXmlFieldTable] <span style="color:blue;">PRIMARY KEY
</span><span style="color:gray;">(
    </span>[UID] <span style="color:blue;">ASC
</span><span style="color:gray;">) </span><span style="color:blue;">WITH </span><span style="color:gray;">(</span><span style="color:blue;">PAD_INDEX  </span><span style="color:gray;">= </span><span style="color:blue;">OFF</span><span style="color:gray;">, </span><span style="color:blue;">STATISTICS_NORECOMPUTE  </span><span style="color:gray;">= </span><span style="color:blue;">OFF</span><span style="color:gray;">, </span><span style="color:blue;">IGNORE_DUP_KEY </span><span style="color:gray;">= </span><span style="color:blue;">OFF</span><span style="color:gray;">, </span><span style="color:blue;">ALLOW_ROW_LOCKS  </span><span style="color:gray;">= </span><span style="color:blue;">ON</span><span style="color:gray;">, </span><span style="color:blue;">ALLOW_PAGE_LOCKS  </span><span style="color:gray;">= </span><span style="color:blue;">ON</span><span style="color:gray;">) </span><span style="color:blue;">ON </span>[PRIMARY]
<span style="color:gray;">) </span><span style="color:blue;">ON </span>[PRIMARY]

<span style="color:blue;">GO

ALTER TABLE </span>[dbo]<span style="color:gray;">.</span>[MyXmlFieldTable] <span style="color:blue;">ADD  CONSTRAINT </span>[DF_MyXmlFieldTable_TimeCreated]  <span style="color:blue;">DEFAULT </span><span style="color:gray;">(</span><span style="color:magenta;">getdate</span><span style="color:gray;">()) </span><span style="color:blue;">FOR </span>[TimeCreated]
<span style="color:blue;">GO

</span><span style="color:green;">-- =============================================
-- Author:      Chris Cavanagh
-- Create date: 3/15/2011
-- Description: Get XQuery value (string)
-- =============================================
</span><span style="color:blue;">CREATE FUNCTION </span>XQueryString
<span style="color:gray;">(
    </span>@xml <span style="color:blue;">xml</span><span style="color:gray;">,
    </span>@xpath <span style="color:blue;">varchar</span><span style="color:gray;">(</span>200<span style="color:gray;">)
)
</span><span style="color:blue;">RETURNS nvarchar</span><span style="color:gray;">(</span>4000<span style="color:gray;">)
</span><span style="color:blue;">AS
BEGIN
    DECLARE </span>@Result <span style="color:blue;">nvarchar</span><span style="color:gray;">(</span>4000<span style="color:gray;">)
    </span><span style="color:blue;">RETURN </span>@Result
<span style="color:blue;">END
GO

</span><span style="color:green;">-- =============================================
-- Author:      Chris Cavanagh
-- Create date: 3/15/2011
-- Description: Get XQuery value (datetime)
-- =============================================
</span><span style="color:blue;">CREATE FUNCTION </span>XQueryDateTime
<span style="color:gray;">(
    </span>@xml <span style="color:blue;">xml</span><span style="color:gray;">,
    </span>@xpath <span style="color:blue;">varchar</span><span style="color:gray;">(</span>200<span style="color:gray;">)
)
</span><span style="color:blue;">RETURNS datetime
AS
BEGIN
    DECLARE </span>@Result <span style="color:blue;">datetime
    RETURN </span>@Result
<span style="color:blue;">END
GO

</span><span style="color:green;">-- =============================================
-- Author:      Chris Cavanagh
-- Create date: 3/15/2011
-- Description: Get XQuery value (float)
-- =============================================
</span><span style="color:blue;">CREATE FUNCTION </span>XQueryFloat
<span style="color:gray;">(
    </span>@xml <span style="color:blue;">xml</span><span style="color:gray;">,
    </span>@xpath <span style="color:blue;">varchar</span><span style="color:gray;">(</span>200<span style="color:gray;">)
)
</span><span style="color:blue;">RETURNS float
AS
BEGIN
    DECLARE </span>@Result <span style="color:blue;">float
    RETURN </span>@Result
<span style="color:blue;">END
GO

</span><span style="color:green;">-- =============================================
-- Author:      Chris Cavanagh
-- Create date: 3/15/2011
-- Description: Get XQuery value (bit)
-- =============================================
</span><span style="color:blue;">CREATE FUNCTION </span>XQueryBit
<span style="color:gray;">(
    </span>@xml <span style="color:blue;">xml</span><span style="color:gray;">,
    </span>@xpath <span style="color:blue;">varchar</span><span style="color:gray;">(</span>200<span style="color:gray;">)
)
</span><span style="color:blue;">RETURNS bit
AS
BEGIN
    DECLARE </span>@Result <span style="color:blue;">bit
    RETURN </span>@Result
<span style="color:blue;">END
GO

</span><span style="color:green;">-- =============================================
-- Author:      Chris Cavanagh
-- Create date: 3/15/2011
-- Description: Get XQuery value (compare)
-- =============================================
</span><span style="color:blue;">CREATE FUNCTION </span>XQueryCompare
<span style="color:gray;">(
    </span>@xml <span style="color:blue;">xml</span><span style="color:gray;">,
    </span>@xpath <span style="color:blue;">varchar</span><span style="color:gray;">(</span>200<span style="color:gray;">),
    </span>@oper <span style="color:blue;">varchar</span><span style="color:gray;">(</span>10<span style="color:gray;">),
    </span>@value <span style="color:blue;">nvarchar</span><span style="color:gray;">(</span>4000<span style="color:gray;">)
)
</span><span style="color:blue;">RETURNS bit
AS
BEGIN
    DECLARE </span>@Result <span style="color:blue;">bit
    RETURN </span>@Result
<span style="color:blue;">END
GO</span></pre>
<p>Once you add these functions to your DBML file (through the designer, or manually if you prefer) you’ll be able to write LINQ queries that call them.&#160; Here’s a simple example:</p>
<pre class="code"><span style="color:blue;">var </span><span style="color:black;">results = </span><span style="color:blue;">from </span><span style="color:black;">r </span><span style="color:blue;">in </span><span style="color:black;">MyXmlFieldTable
    </span><span style="color:blue;">let </span><span style="color:black;">date = context.XQueryDateTime( r.XmlValues, </span><span style="color:#dc1414;">&quot;MyContainer/MyDateTime&quot; </span><span style="color:black;">)
    </span><span style="color:blue;">where </span><span style="color:black;">date &lt; DateTime.Now.AddDays( -</span><span style="color:#c81efa;">5 </span><span style="color:black;">)
    </span><span style="color:blue;">select new
    </span><span style="color:black;">{
        Date = date,
        FirstName = context.XQueryString( r.XmlValues, </span><span style="color:#dc1414;">&quot;MyContainer/FirstName&quot; </span><span style="color:black;">),
        LastName = context.XQueryString( r.XmlValues, </span><span style="color:#dc1414;">&quot;MyContainer/LastName&quot; </span><span style="color:black;">)
    };</span></pre>
<p>With this, we can use some Regex magic to expand the function names into XQuery expressions:</p>
<pre class="code"><span style="color:blue;">public class </span><span style="color:black;">XQueryHelper
{
    </span><span style="color:blue;">private static </span><span style="color:black;">Regex regex = </span><span style="color:blue;">new </span><span style="color:black;">Regex( </span><span style="color:#dc1414;">@&quot;\[dbo\]\.\[XQuery(?&lt;type&gt;.*?)\]\(\s?(?&lt;column&gt;\([^\(\)]*(((?'Open'\()[^\(\)]*)+((?'Close-Open'\))[^\(\)]*)+)*(?(Open)(?!))\)|([\s\S]*?)),\s?(?&lt;xpath&gt;.*?)(,\s?(?&lt;oper&gt;.*?),\s?(?&lt;value&gt;.*?))?\s?\)&quot;</span><span style="color:black;">, RegexOptions.Compiled );

    </span><span style="color:blue;">public static string </span><span style="color:black;">OptimizeSql( </span><span style="color:blue;">string </span><span style="color:black;">commandText, IDictionary&lt;</span><span style="color:blue;">string</span><span style="color:black;">, </span><span style="color:blue;">object</span><span style="color:black;">&gt; parameters )
    {
        </span><span style="color:blue;">return </span><span style="color:black;">regex.Replace(
            commandText,
            </span><span style="color:blue;">delegate</span><span style="color:black;">( Match m )
            {
                </span><span style="color:blue;">var </span><span style="color:black;">column = m.Groups[ </span><span style="color:#dc1414;">&quot;column&quot; </span><span style="color:black;">].Value;
                </span><span style="color:blue;">var </span><span style="color:black;">xpath = parameters[ m.Groups[ </span><span style="color:#dc1414;">&quot;xpath&quot; </span><span style="color:black;">].Value ];

                </span><span style="color:blue;">var </span><span style="color:black;">sqlType = </span><span style="color:#dc1414;">&quot;nvarchar( 4000 )&quot;</span><span style="color:black;">;
                </span><span style="color:blue;">var </span><span style="color:black;">compare = </span><span style="color:#dc1414;">&quot;&quot;</span><span style="color:black;">;
                </span><span style="color:blue;">var </span><span style="color:black;">type = m.Groups[ </span><span style="color:#dc1414;">&quot;type&quot; </span><span style="color:black;">].Value;

                </span><span style="color:blue;">switch </span><span style="color:black;">( type )
                {
                    </span><span style="color:blue;">case </span><span style="color:#dc1414;">&quot;Float&quot;</span><span style="color:black;">: sqlType = </span><span style="color:#dc1414;">&quot;float&quot;</span><span style="color:black;">; </span><span style="color:blue;">break</span><span style="color:black;">;
                    </span><span style="color:blue;">case </span><span style="color:#dc1414;">&quot;DateTime&quot;</span><span style="color:black;">: sqlType = </span><span style="color:#dc1414;">&quot;datetime&quot;</span><span style="color:black;">; </span><span style="color:blue;">break</span><span style="color:black;">;
                    </span><span style="color:blue;">case </span><span style="color:#dc1414;">&quot;Bit&quot;</span><span style="color:black;">: sqlType = </span><span style="color:#dc1414;">&quot;int&quot;</span><span style="color:black;">; compare = </span><span style="color:#dc1414;">&quot; = 1&quot;</span><span style="color:black;">; </span><span style="color:blue;">break</span><span style="color:black;">;
                    </span><span style="color:blue;">case </span><span style="color:#dc1414;">&quot;Compare&quot;</span><span style="color:black;">:
                    {
                        </span><span style="color:blue;">var </span><span style="color:black;">oper = parameters[ m.Groups[ </span><span style="color:#dc1414;">&quot;oper&quot; </span><span style="color:black;">].Value ];
                        </span><span style="color:blue;">var </span><span style="color:black;">valueParam = m.Groups[ </span><span style="color:#dc1414;">&quot;value&quot; </span><span style="color:black;">].Value;

                        </span><span style="color:blue;">var </span><span style="color:black;">value = valueParam.StartsWith( </span><span style="color:#dc1414;">&quot;@&quot; </span><span style="color:black;">)
                            ? </span><span style="color:blue;">string</span><span style="color:black;">.Format( </span><span style="color:#dc1414;">&quot;sql:variable(\&quot;{0}\&quot;)&quot;</span><span style="color:black;">, valueParam )
                            : </span><span style="color:blue;">string</span><span style="color:black;">.Format( </span><span style="color:#dc1414;">&quot;\&quot;{0}\&quot;&quot;</span><span style="color:black;">, valueParam );

                        </span><span style="color:blue;">return string</span><span style="color:black;">.Format( </span><span style="color:#dc1414;">&quot;{0}.exist('{1}[.{2}{3}]')&quot;</span><span style="color:black;">, column, xpath, oper, value );
                    }
                }

                </span><span style="color:blue;">return string</span><span style="color:black;">.Format( </span><span style="color:#dc1414;">&quot;{0}.value('({1})[1]', '{2}'){3}&quot;</span><span style="color:black;">, column, xpath, sqlType, compare );
            } );
    }
}</span></pre>
<p>Here’s where you need to decide between the “safe” and risky ways to manipulate the command text.&#160; Here’s the safe way:</p>
<pre class="code">    <span style="color:blue;">var </span><span style="color:black;">command = context.GetCommand( results );
    </span><span style="color:blue;">var </span><span style="color:black;">parameters = command.Parameters.Cast&lt;DbParameter&gt;().ToDictionary( p =&gt; p.ParameterName, p =&gt; p.Value );

    command.CommandText = XQueryHelper.OptimizeSql( command.CommandText, parameters );

    </span><span style="color:blue;">var </span><span style="color:black;">newResults = context.ExecuteQuery( command.CommandText, parameters.Values );</span></pre>
<p>The riskier (but more flexible and robust) way is <a href="http://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/" target="_blank">discussed here</a>.&#160; Using this, all you need to do is modify your DataContext before executing the query.</p>
<pre class="code">    <span style="color:black;">context = DataContextInterceptor.Intercept( context, XQueryHelper.OptimizeSql );</span></pre>
<p>Hope you find this useful! <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://chriscavanagh.files.wordpress.com/2011/03/wlemoticon-smile1.png?w=490" /></p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/617/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/617/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/617/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/617/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/617/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/617/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/617/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/617/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/617/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/617/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/617/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/617/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/617/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/617/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=617&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2011/03/wlemoticon-smile1.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>Modifying LINQ To SQL command text</title>
		<link>http://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/</link>
		<comments>http://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 23:12:34 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/</guid>
		<description><![CDATA[UPDATE &#8211; To see an example use for this code, see this post where I discuss supporting native XQuery using LINQ to SQL. HACK WARNING – This example calls private framework methods through Reflection.&#160; It’s bad practice in almost every way.&#160; Also, it’s unlikely to work in a partial trust environment.&#160; Use at your own [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=611&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE</strong> &#8211; To see an example use for this code, see <a href="http://chriscavanagh.wordpress.com/2011/03/15/sql-server-xquery-with-linq-to-sql/" target="_blank">this post</a> where I discuss supporting native XQuery using LINQ to SQL.</p>
<p><strong>HACK WARNING</strong> – This example calls private framework methods through Reflection.&#160; It’s bad practice in almost every way.&#160; Also, it’s unlikely to work in a partial trust environment.&#160; Use at your own risk <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://chriscavanagh.files.wordpress.com/2011/03/wlemoticon-smile.png?w=490" /></p>
<p>Here’s a bit of code that’ll let you modify any command text LINQ To SQL generates before it hits the database.&#160; It’s always been possible to call <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getcommand.aspx" target="_blank">DataContext.GetCommand</a> and use modified SQL in a call to <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.translate.aspx" target="_blank">DataContext.Translate</a> or <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executequery.aspx" target="_blank">DataContext.ExecuteQuery</a>, but that’s pretty restrictive in the complexity of query you can use.&#160; Also, if LINQ To SQL decides it needs to batch multiple SELECT statements for the desired results, GetCommand can only give you the first one.</p>
<p>The first thing to do is replace the IProvider implementation used by your DataContext.&#160; Unfortunately, DataContext’s Provider property is both private and read-only.&#160; Also, the IProvider interface itself is private.&#160; This is bad in every way, and we absolutely shouldn’t try to hack our way through that… but we will.</p>
<p>Inspired by a <a href="http://blogs.msdn.com/b/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx" target="_blank">2008 post by Matt Warren</a>, I made the following DataContextInterceptor helper.&#160; It intercepts calls to the IProvider’s Compile and Execute methods.&#160; Rather than rewrite most of the SqlProvider code, it calls the same private methods it normally would, albeit through reflection.&#160; The only other thing it does is call the ModifyCommandDelegate delegate (assigned by your code) with the command text and parameters.</p>
<p>Although it’s not the cleanest solution, it’s pretty much transparent to LINQ To SQL.&#160; You can use complex queries (even compiled ones via <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.compiledquery.compile.aspx" target="_blank">CompiledQuery.Compile</a>) and they work just fine:</p>
<pre class="code">    <span style="color:blue;">public class </span><span style="color:#2b91af;">DataContextInterceptor
    </span>{
        <span style="color:blue;">public delegate string </span><span style="color:#2b91af;">ModifyCommandDelegate</span>( <span style="color:blue;">string </span>commandText, <span style="color:#2b91af;">IDictionary</span>&lt;<span style="color:blue;">string</span>, <span style="color:blue;">object</span>&gt; parameters );

        <span style="color:blue;">private </span><span style="color:#2b91af;">DataContext </span>dc;
        <span style="color:blue;">private object </span>oldProvider;
        <span style="color:blue;">private </span><span style="color:#2b91af;">Type </span>providerType;
        <span style="color:blue;">private </span><span style="color:#2b91af;">ModifyCommandDelegate </span>modifyCommand;

        <span style="color:blue;">public static </span>TDataContext Intercept&lt;TDataContext&gt;( TDataContext dc, <span style="color:#2b91af;">ModifyCommandDelegate </span>modifyCommand )
            <span style="color:blue;">where </span>TDataContext : <span style="color:#2b91af;">DataContext
        </span>{
            <span style="color:blue;">new </span><span style="color:#2b91af;">DataContextInterceptor</span>( dc, modifyCommand );

            <span style="color:blue;">return </span>dc;
        }

        <span style="color:blue;">public </span>DataContextInterceptor( <span style="color:#2b91af;">DataContext </span>dc, <span style="color:#2b91af;">ModifyCommandDelegate </span>modifyCommand )
        {
            <span style="color:blue;">this</span>.dc = dc;
            <span style="color:blue;">this</span>.modifyCommand = modifyCommand;

            <span style="color:#2b91af;">FieldInfo </span>providerField = <span style="color:blue;">typeof</span>( <span style="color:#2b91af;">DataContext </span>).GetField( <span style="color:#a31515;">&quot;provider&quot;</span>, <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.NonPublic );
            <span style="color:blue;">var </span>existingProvider = providerField.GetValue( dc );

            <span style="color:blue;">if </span>( existingProvider <span style="color:blue;">is </span><span style="color:#2b91af;">SqlProvider </span>)
            {
                oldProvider = existingProvider;

                <span style="color:blue;">var </span>proxy = <span style="color:blue;">new </span><span style="color:#2b91af;">ProviderProxy</span>( <span style="color:blue;">this</span>, oldProvider ).GetTransparentProxy();

                providerField.SetValue( dc, proxy );
            }
        }

        <span style="color:blue;">public static </span><span style="color:#2b91af;">MethodInfo </span>GetMethod( <span style="color:#2b91af;">Type </span>type, <span style="color:blue;">string </span>methodName, <span style="color:blue;">params object</span>[] args )
        {
            <span style="color:blue;">var </span>hasNullArgs = args.Any( a =&gt; a == <span style="color:blue;">null </span>);

            <span style="color:blue;">var </span>method = hasNullArgs
                ? type.GetMethods( <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.Public | <span style="color:#2b91af;">BindingFlags</span>.NonPublic )
                    .FirstOrDefault( m =&gt; m.Name == methodName )
                : <span style="color:blue;">null</span>;

            <span style="color:blue;">if </span>( method == <span style="color:blue;">null </span>&amp;&amp; !hasNullArgs )
            {
                method = type.GetMethod(
                    methodName,
                    <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.Public | <span style="color:#2b91af;">BindingFlags</span>.NonPublic,
                    <span style="color:blue;">null</span>,
                    args.Select( a =&gt; a.GetType() ).ToArray(),
                    <span style="color:blue;">null </span>);
            }

            <span style="color:blue;">return </span>method;
        }

        <span style="color:blue;">private object </span>Invoke( <span style="color:blue;">object </span>instance, <span style="color:blue;">string </span>methodName, <span style="color:blue;">params object</span>[] args )
        {
            <span style="color:blue;">var </span>type = instance.GetType();
            <span style="color:blue;">var </span>method = GetMethod( type, methodName, args );

            <span style="color:blue;">return </span>( method != <span style="color:blue;">null </span>)
                ? method.Invoke( instance, args )
                : <span style="color:blue;">null</span>;
        }

        <span style="color:blue;">private object </span>Invoke( <span style="color:#2b91af;">Type </span>type, <span style="color:blue;">string </span>methodName, <span style="color:blue;">params object</span>[] args )
        {
            <span style="color:blue;">var </span>method = type.GetMethod( methodName, <span style="color:#2b91af;">BindingFlags</span>.Static | <span style="color:#2b91af;">BindingFlags</span>.Public | <span style="color:#2b91af;">BindingFlags</span>.NonPublic );

            <span style="color:blue;">return </span>method.Invoke( <span style="color:blue;">null</span>, args );
        }

        <span style="color:blue;">protected object </span>CompileImpl( <span style="color:#2b91af;">Expression </span>query )
        {
            <span style="color:blue;">var </span>assembly = <span style="color:blue;">typeof</span>( <span style="color:#2b91af;">SqlProvider </span>).Assembly;

            <span style="color:green;">/*
            this.CheckDispose();
            this.CheckInitialized();
            if ( query == null )
            {
                throw Error.ArgumentNull( &quot;query&quot; );
            }
            */

            // this.InitializeProviderMode();
            </span>Invoke( oldProvider, <span style="color:#a31515;">&quot;InitializeProviderMode&quot; </span>);

            <span style="color:green;">// SqlNodeAnnotations annotations = new SqlNodeAnnotations();
            </span><span style="color:blue;">var </span>annotations = <span style="color:#2b91af;">Activator</span>.CreateInstance( assembly.GetType( <span style="color:#a31515;">&quot;System.Data.Linq.SqlClient.SqlNodeAnnotations&quot; </span>) );

            <span style="color:green;">// QueryInfo[] queries = this.BuildQuery( query, annotations );
            </span><span style="color:blue;">var </span>queries = Invoke( oldProvider, <span style="color:#a31515;">&quot;BuildQuery&quot;</span>, query, annotations );

            <span style="color:blue;">var </span>info = ModifyQueries( (<span style="color:#2b91af;">IEnumerable</span>)queries );

            <span style="color:green;">// this.CheckSqlCompatibility( queries, annotations );
            </span>Invoke( oldProvider, <span style="color:#a31515;">&quot;CheckSqlCompatibility&quot;</span>, queries, annotations );

            <span style="color:#2b91af;">LambdaExpression </span>expression = query <span style="color:blue;">as </span><span style="color:#2b91af;">LambdaExpression</span>;

            <span style="color:blue;">if </span>( expression != <span style="color:blue;">null </span>)
            {
                query = expression.Body;
            }

            <span style="color:green;">// IObjectReaderFactory readerFactory = null;
            </span><span style="color:blue;">object </span>readerFactory = <span style="color:blue;">null</span>;

            <span style="color:green;">// ICompiledSubQuery[] subQueries = null;
            </span><span style="color:blue;">object </span>subQueries = <span style="color:blue;">null</span>;

            <span style="color:green;">// QueryInfo info = queries[ queries.Length - 1 ];
            // info defined above

            </span><span style="color:blue;">var </span>resultShape = (<span style="color:blue;">int</span>)Invoke( info, <span style="color:#a31515;">&quot;get_ResultShape&quot; </span>);

            <span style="color:green;">// if ( info.ResultShape == ResultShape.Singleton )
            </span><span style="color:blue;">if </span>( resultShape == 1 <span style="color:green;">/* Singleton */ </span>)
            {
                <span style="color:green;">// subQueries = this.CompileSubQueries( info.Query );
                </span>subQueries = Invoke( oldProvider, <span style="color:#a31515;">&quot;CompileSubQueries&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>) );

                <span style="color:green;">// readerFactory = this.GetReaderFactory( info.Query, info.ResultType );
                </span>readerFactory = Invoke( oldProvider, <span style="color:#a31515;">&quot;GetReaderFactory&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>), Invoke( info, <span style="color:#a31515;">&quot;get_ResultType&quot; </span>) );
            }
            <span style="color:green;">// else if ( info.ResultShape == ResultShape.Sequence )
            </span><span style="color:blue;">else if </span>( resultShape == 2 <span style="color:green;">/* Sequence */ </span>)
            {
                <span style="color:green;">// subQueries = this.CompileSubQueries( info.Query );
                </span>subQueries = Invoke( oldProvider, <span style="color:#a31515;">&quot;CompileSubQueries&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>) );

                <span style="color:green;">// readerFactory = this.GetReaderFactory( info.Query, TypeSystem.GetElementType( info.ResultType ) );
                </span><span style="color:blue;">var </span>resultType = Invoke( info, <span style="color:#a31515;">&quot;get_ResultType&quot; </span>);
                <span style="color:blue;">var </span>typeSystemType = assembly.GetType( <span style="color:#a31515;">&quot;System.Data.Linq.SqlClient.TypeSystem&quot; </span>);
                <span style="color:blue;">var </span>elementType = Invoke( typeSystemType, <span style="color:#a31515;">&quot;GetElementType&quot;</span>, resultType );

                readerFactory = Invoke( oldProvider, <span style="color:#a31515;">&quot;GetReaderFactory&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>), elementType );
            }

            <span style="color:#2b91af;">FieldInfo </span>providerField = <span style="color:blue;">typeof</span>( <span style="color:#2b91af;">DataContext </span>).GetField( <span style="color:#a31515;">&quot;provider&quot;</span>, <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.NonPublic );
            providerField.SetValue( dc, oldProvider );

            <span style="color:green;">// return new CompiledQuery( this, query, queries, readerFactory, subQueries );
            </span><span style="color:blue;">var </span>compiledQueryType = assembly.GetType( <span style="color:#a31515;">&quot;System.Data.Linq.SqlClient.SqlProvider+CompiledQuery&quot; </span>);

            <span style="color:blue;">return </span><span style="color:#2b91af;">Activator</span>.CreateInstance(
                compiledQueryType,
                <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.Public | <span style="color:#2b91af;">BindingFlags</span>.NonPublic,
                <span style="color:blue;">null</span>,
                <span style="color:blue;">new object</span>[] { oldProvider, query, queries, readerFactory, subQueries },
                <span style="color:blue;">null </span>);
        }

        <span style="color:blue;">protected internal virtual </span><span style="color:#2b91af;">IExecuteResult </span>ExecuteImpl( <span style="color:#2b91af;">Expression </span>query )
        {
            <span style="color:blue;">var </span>assembly = <span style="color:blue;">typeof</span>( <span style="color:#2b91af;">SqlProvider </span>).Assembly;

            <span style="color:green;">/*
            this.CheckDispose();
            this.CheckInitialized();
            this.CheckNotDeleted();
            if (query == null)
            {
                throw Error.ArgumentNull(&quot;query&quot;);
            }
            */

            // this.InitializeProviderMode();
            </span>Invoke( oldProvider, <span style="color:#a31515;">&quot;InitializeProviderMode&quot; </span>);

            <span style="color:green;">// query = Funcletizer.Funcletize(query);
            </span><span style="color:blue;">var </span>funcletizerType = assembly.GetType( <span style="color:#a31515;">&quot;System.Data.Linq.SqlClient.Funcletizer&quot; </span>);
            query = (<span style="color:#2b91af;">Expression</span>)Invoke( funcletizerType, <span style="color:#a31515;">&quot;Funcletize&quot;</span>, query );

            <span style="color:green;">// if ( this.EnableCacheLookup )
            </span><span style="color:blue;">if </span>( (<span style="color:blue;">bool</span>)Invoke( oldProvider, <span style="color:#a31515;">&quot;get_EnableCacheLookup&quot; </span>) )
            {
                <span style="color:green;">// IExecuteResult cachedResult = this.GetCachedResult(query);
                </span><span style="color:blue;">object </span>cachedResult = Invoke( oldProvider, <span style="color:#a31515;">&quot;GetCachedResult&quot;</span>, query );

                <span style="color:blue;">if </span>( cachedResult != <span style="color:blue;">null </span>)
                {
                    <span style="color:green;">// return cachedResult;
                    </span><span style="color:blue;">return </span>(<span style="color:#2b91af;">IExecuteResult</span>)cachedResult;
                }
            }

            <span style="color:green;">// SqlNodeAnnotations annotations = new SqlNodeAnnotations();
            </span><span style="color:blue;">var </span>annotations = <span style="color:#2b91af;">Activator</span>.CreateInstance( assembly.GetType( <span style="color:#a31515;">&quot;System.Data.Linq.SqlClient.SqlNodeAnnotations&quot; </span>) );

            <span style="color:green;">// QueryInfo[] queries = this.BuildQuery(query, annotations);
            </span><span style="color:blue;">var </span>queries = Invoke( oldProvider, <span style="color:#a31515;">&quot;BuildQuery&quot;</span>, query, annotations );

            <span style="color:blue;">var </span>info = ModifyQueries( (<span style="color:#2b91af;">IEnumerable</span>)queries );

            <span style="color:green;">// this.CheckSqlCompatibility(queries, annotations);
            </span>Invoke( oldProvider, <span style="color:#a31515;">&quot;CheckSqlCompatibility&quot;</span>, queries, annotations );

            <span style="color:#2b91af;">LambdaExpression </span>expression = query <span style="color:blue;">as </span><span style="color:#2b91af;">LambdaExpression</span>;

            <span style="color:blue;">if </span>( expression != <span style="color:blue;">null </span>)
            {
                query = expression.Body;
            }

            <span style="color:green;">// IObjectReaderFactory readerFactory = null;
            </span><span style="color:blue;">object </span>readerFactory = <span style="color:blue;">null</span>;

            <span style="color:green;">// ICompiledSubQuery[] subQueries = null;
            </span><span style="color:blue;">object </span>subQueries = <span style="color:blue;">null</span>;

            <span style="color:green;">// QueryInfo info = queries[queries.Length - 1];
            // info defined above

            </span><span style="color:blue;">var </span>resultShape = (<span style="color:blue;">int</span>)Invoke( info, <span style="color:#a31515;">&quot;get_ResultShape&quot; </span>);

            <span style="color:green;">// if (info.ResultShape == ResultShape.Singleton)
            </span><span style="color:blue;">if </span>( resultShape == 1 <span style="color:green;">/* Singleton */ </span>)
            {
                <span style="color:green;">// subQueries = this.CompileSubQueries(info.Query);
                </span>subQueries = Invoke( oldProvider, <span style="color:#a31515;">&quot;CompileSubQueries&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>) );

                <span style="color:green;">// readerFactory = this.GetReaderFactory(info.Query, info.ResultType);
                </span>readerFactory = Invoke( oldProvider, <span style="color:#a31515;">&quot;GetReaderFactory&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>), Invoke( info, <span style="color:#a31515;">&quot;get_ResultType&quot; </span>) );
            }
            <span style="color:green;">// else if (info.ResultShape == ResultShape.Sequence)
            </span><span style="color:blue;">else if </span>( resultShape == 2 <span style="color:green;">/* Sequence */ </span>)
            {
                <span style="color:green;">// subQueries = this.CompileSubQueries(info.Query);
                </span>subQueries = Invoke( oldProvider, <span style="color:#a31515;">&quot;CompileSubQueries&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>) );

                <span style="color:green;">// readerFactory = this.GetReaderFactory(info.Query, TypeSystem.GetElementType(info.ResultType));
                </span><span style="color:blue;">var </span>resultType = Invoke( info, <span style="color:#a31515;">&quot;get_ResultType&quot; </span>);
                <span style="color:blue;">var </span>typeSystemType = assembly.GetType( <span style="color:#a31515;">&quot;System.Data.Linq.SqlClient.TypeSystem&quot; </span>);
                <span style="color:blue;">var </span>elementType = Invoke( typeSystemType, <span style="color:#a31515;">&quot;GetElementType&quot;</span>, resultType );

                readerFactory = Invoke( oldProvider, <span style="color:#a31515;">&quot;GetReaderFactory&quot;</span>, Invoke( info, <span style="color:#a31515;">&quot;get_Query&quot; </span>), elementType );
            }

            <span style="color:green;">// return this.ExecuteAll(query, queries, readerFactory, null, subQueries);
            </span><span style="color:blue;">return </span>(<span style="color:#2b91af;">IExecuteResult</span>)Invoke( oldProvider, <span style="color:#a31515;">&quot;ExecuteAll&quot;</span>, query, queries, readerFactory, <span style="color:blue;">null</span>, subQueries );
        }

        <span style="color:blue;">private object </span>ModifyQueries( <span style="color:#2b91af;">IEnumerable </span>queries )
        {
            <span style="color:blue;">object </span>lastQuery = <span style="color:blue;">null</span>;

            <span style="color:blue;">foreach </span>( <span style="color:blue;">var </span>q <span style="color:blue;">in </span>queries )
            {
                lastQuery = q;

                <span style="color:blue;">var </span>commandTextField = q.GetType().GetField( <span style="color:#a31515;">&quot;commandText&quot;</span>, <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.Public | <span style="color:#2b91af;">BindingFlags</span>.NonPublic );
                <span style="color:blue;">var </span>parametersField = q.GetType().GetField( <span style="color:#a31515;">&quot;parameters&quot;</span>, <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.Public | <span style="color:#2b91af;">BindingFlags</span>.NonPublic );

                <span style="color:blue;">var </span>commandText = (<span style="color:blue;">string</span>)commandTextField.GetValue( q );
                <span style="color:blue;">var </span>parameters = <span style="color:blue;">new </span><span style="color:#2b91af;">Dictionary</span>&lt;<span style="color:blue;">string</span>, <span style="color:blue;">object</span>&gt;();

                <span style="color:blue;">foreach </span>( <span style="color:blue;">var </span>p <span style="color:blue;">in </span>(<span style="color:#2b91af;">IEnumerable</span>)parametersField.GetValue( q ) )
                {
                    <span style="color:blue;">var </span>name = (<span style="color:blue;">string</span>)Invoke( Invoke( p, <span style="color:#a31515;">&quot;get_Parameter&quot; </span>), <span style="color:#a31515;">&quot;get_Name&quot; </span>);
                    parameters[ name ] = Invoke( p, <span style="color:#a31515;">&quot;get_Value&quot; </span>);
                }

                <span style="color:blue;">var </span>modifiedCommandText = modifyCommand( commandText, parameters );

                commandTextField.SetValue( q, modifiedCommandText );
            }

            <span style="color:blue;">return </span>lastQuery;
        }

        <span style="color:blue;">public class </span><span style="color:#2b91af;">ProviderProxy </span>: <span style="color:#2b91af;">RealProxy</span>, <span style="color:#2b91af;">IRemotingTypeInfo
        </span>{
            <span style="color:#2b91af;">DataContextInterceptor </span>extender;
            <span style="color:blue;">object </span>oldProvider;

            <span style="color:blue;">internal </span>ProviderProxy( <span style="color:#2b91af;">DataContextInterceptor </span>extender, <span style="color:blue;">object </span>oldProvider )
                : <span style="color:blue;">base</span>( <span style="color:blue;">typeof</span>( <span style="color:#2b91af;">ContextBoundObject </span>) )
            {
                <span style="color:blue;">this</span>.extender = extender;
                <span style="color:blue;">this</span>.oldProvider = oldProvider;
            }

            <span style="color:blue;">public override </span><span style="color:#2b91af;">IMessage </span>Invoke( <span style="color:#2b91af;">IMessage </span>msg )
            {
                <span style="color:blue;">if </span>( msg <span style="color:blue;">is </span><span style="color:#2b91af;">IMethodCallMessage </span>)
                {
                    <span style="color:#2b91af;">IMethodCallMessage </span>call = (<span style="color:#2b91af;">IMethodCallMessage</span>)msg;
                    <span style="color:#2b91af;">MethodInfo </span>mi = <span style="color:blue;">null</span>;

                    <span style="color:blue;">if </span>( call.MethodBase.DeclaringType.Name == <span style="color:#a31515;">&quot;IProvider&quot; </span>&amp;&amp; call.MethodBase.DeclaringType.IsInterface )
                    {
                        extender.providerType = call.MethodBase.DeclaringType;

                        mi = <span style="color:#2b91af;">DataContextInterceptor</span>.GetMethod( <span style="color:blue;">typeof</span>( <span style="color:#2b91af;">DataContextInterceptor </span>), call.MethodBase.Name + <span style="color:#a31515;">&quot;Impl&quot;</span>, call.Args );

                        <span style="color:blue;">if </span>( mi == <span style="color:blue;">null </span>&amp;&amp; oldProvider != <span style="color:blue;">null </span>)
                        {
                            mi = <span style="color:#2b91af;">DataContextInterceptor</span>.GetMethod( call.MethodBase.DeclaringType, call.MethodBase.Name, call.Args );

                            <span style="color:blue;">return new </span><span style="color:#2b91af;">ReturnMessage</span>( mi.Invoke( oldProvider, call.Args ), <span style="color:blue;">null</span>, 0, <span style="color:blue;">null</span>, call );
                        }

                        <span style="color:blue;">if </span>( mi != <span style="color:blue;">null </span>)
                        {
                            <span style="color:blue;">try
                            </span>{
                                <span style="color:blue;">return new </span><span style="color:#2b91af;">ReturnMessage</span>( mi.Invoke( <span style="color:blue;">this</span>.extender, call.Args ), <span style="color:blue;">null</span>, 0, <span style="color:blue;">null</span>, call );
                            }
                            <span style="color:blue;">catch </span>( <span style="color:#2b91af;">TargetInvocationException </span>e )
                            {
                                <span style="color:blue;">return new </span><span style="color:#2b91af;">ReturnMessage</span>( e.InnerException, call );
                            }
                        }
                    }
<span style="color:green;">//                    else mi = typeof( DataContextInterceptor ).GetMethod( call.MethodBase.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic );
                    </span><span style="color:blue;">else
                    </span>{
                        mi = <span style="color:#2b91af;">DataContextInterceptor</span>.GetMethod( oldProvider.GetType(), call.MethodBase.Name, call.Args );

                        <span style="color:blue;">if </span>( mi != <span style="color:blue;">null </span>)
                        {
                            <span style="color:blue;">try
                            </span>{
                                <span style="color:blue;">return new </span><span style="color:#2b91af;">ReturnMessage</span>( mi.Invoke( oldProvider, call.Args ), <span style="color:blue;">null</span>, 0, <span style="color:blue;">null</span>, call );
                            }
                            <span style="color:blue;">catch </span>( <span style="color:#2b91af;">TargetInvocationException </span>e )
                            {
                                <span style="color:blue;">return new </span><span style="color:#2b91af;">ReturnMessage</span>( e.InnerException, call );
                            }
                        }
                    }

                    <span style="color:blue;">throw new </span><span style="color:#2b91af;">NotImplementedException</span>(
                        <span style="color:blue;">string</span>.Format( <span style="color:#a31515;">&quot;Method not found: {0}( {1} )&quot;</span>,
                            call.MethodBase.Name,
                            <span style="color:blue;">string</span>.Join( <span style="color:#a31515;">&quot;, &quot;</span>, call.Args.Select( a =&gt; <span style="color:#2b91af;">Convert</span>.ToString( a ) ) ) ) );
                }

                <span style="color:blue;">throw new </span><span style="color:#2b91af;">NotImplementedException</span>();
            }

            <span style="color:blue;">public bool </span>CanCastTo( <span style="color:#2b91af;">Type </span>fromType, <span style="color:blue;">object </span>o )
            {
                <span style="color:blue;">return true</span>;
            }

            <span style="color:blue;">public string </span>TypeName
            {
                <span style="color:blue;">get </span>{ <span style="color:blue;">return this</span>.GetType().Name; }
                <span style="color:blue;">set </span>{ }
            }
        }
    }</pre>
<p>Hope this helps!</p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/611/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=611&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2011/03/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/03/12/manipulating-linq-to-sql-command-text/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>AwesomiumSharp!</title>
		<link>http://chriscavanagh.wordpress.com/2011/02/16/awesomiumsharp/</link>
		<comments>http://chriscavanagh.wordpress.com/2011/02/16/awesomiumsharp/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 21:36:21 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2011/02/16/awesomiumsharp/</guid>
		<description><![CDATA[Here’s a great bit of news for users (victims? ) of my WPF Chromium wrapper – the next version of Awesomium has it’s own official C# wrapper!&#160; You can read all about it here&#160;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=603&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here’s a great bit of news for users (victims? <img style="border-style:none;" class="wlEmoticon wlEmoticon-Inlove" alt="In love" src="http://chriscavanagh.files.wordpress.com/2011/02/wlemoticon-inlove.png?w=490" />) of my WPF Chromium wrapper – the next version of Awesomium has it’s own official C# wrapper!&#160; You can read all about it <a href="http://www.khrona.com/2011/02/16/top-six-new-features/?utm_source=Khrona+Announcements&amp;utm_campaign=2dfc69d61d-Awesomium_v1_6_RC3_Mail&amp;utm_medium=email" target="_blank">here</a>&#160;<img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://chriscavanagh.files.wordpress.com/2011/02/wlemoticon-smile.png?w=490" /></p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2011/02/16/awesomiumsharp/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/02/16/awesomiumsharp/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/603/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=603&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2011/02/16/awesomiumsharp/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2011/02/wlemoticon-inlove.png" medium="image">
			<media:title type="html">In love</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2011/02/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2011/02/16/awesomiumsharp/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.NET MVC Strongly-Typed RenderPartial</title>
		<link>http://chriscavanagh.wordpress.com/2010/12/10/asp-net-mvc-strongly-typed-renderpartial/</link>
		<comments>http://chriscavanagh.wordpress.com/2010/12/10/asp-net-mvc-strongly-typed-renderpartial/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 20:11:45 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2010/12/10/asp-net-mvc-strongly-typed-renderpartial/</guid>
		<description><![CDATA[UPDATE: Actually this thing has several uses, but rather than spend time listing them I’ll invite [polite] suggestions how it can be used… Here’s a small MVC extension method that looks useful, but might be totally redundant: public static void RenderPartial&#60;TModel, TProperty&#62;( this HtmlHelper&#60;TModel&#62; helper, string partialViewName, Expression&#60;Func&#60;TModel, TProperty&#62;&#62; expression ) { var model = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=583&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong> Actually this thing has several uses, but rather than spend time listing them I’ll invite [polite] suggestions how it can be used… <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://chriscavanagh.files.wordpress.com/2010/12/wlemoticon-smile.png?w=490" /></p>
<p>Here’s a small MVC extension method that looks useful, but might be totally redundant:</p>
<pre class="code"><span style="color:blue;">public static void </span>RenderPartial&lt;TModel, TProperty&gt;( <span style="color:blue;">this </span><span style="color:#2b91af;">HtmlHelper</span>&lt;TModel&gt; helper, <span style="color:blue;">string </span>partialViewName, <span style="color:#2b91af;">Expression</span>&lt;<span style="color:#2b91af;">Func</span>&lt;TModel, TProperty&gt;&gt; expression )
{
    <span style="color:blue;">var </span>model = (TModel)helper.ViewData.Model;
    <span style="color:blue;">var </span>childModel = expression.Compile()( model );
    <span style="color:blue;">var </span>viewData = <span style="color:blue;">new </span><span style="color:#2b91af;">ViewDataDictionary</span>&lt;TProperty&gt;( childModel );
    viewData.TemplateInfo.HtmlFieldPrefix = <span style="color:#2b91af;">ExpressionHelper</span>.GetExpressionText( expression );

    helper.RenderPartial( partialViewName, childModel, viewData );
}</pre>
<p>Basically it’s the same as the regular Html.RenderPartial but you can pass your model as an expression.&#160; It’ll handle getting the field name prefixes etc. automatically.</p>
<p>I’m pretty sure the same thing can be achieved with Html.EditorFor and Html.DisplayFor (possibly with better performance too, depending on if they take the <a href="http://msdn.microsoft.com/en-us/library/bb345362.aspx" target="_blank">Compile()</a> hit or not).&#160; However I could be wrong, so I posted it anyway <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://chriscavanagh.files.wordpress.com/2010/12/wlemoticon-smile.png?w=490" /></p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2010/12/10/asp-net-mvc-strongly-typed-renderpartial/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/12/10/asp-net-mvc-strongly-typed-renderpartial/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/583/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/583/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/583/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/583/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/583/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/583/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/583/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/583/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/583/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/583/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/583/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/583/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/583/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/583/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=583&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2010/12/10/asp-net-mvc-strongly-typed-renderpartial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2010/12/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2010/12/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/12/10/asp-net-mvc-strongly-typed-renderpartial/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>Xbox Live Family Pack &#8211; Be careful!</title>
		<link>http://chriscavanagh.wordpress.com/2010/11/05/xbox-live-family-pack-be-careful/</link>
		<comments>http://chriscavanagh.wordpress.com/2010/11/05/xbox-live-family-pack-be-careful/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 05:38:15 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://chriscavanagh.wordpress.com/?p=575</guid>
		<description><![CDATA[The new Xbox Live family pack is a great idea. Just be aware if you have existing Gamertags to add, you can only do that through a console (currently). You need to have all the profiles on the same console (temporarily; just a memory stick will do). Don&#8217;t be tempted to &#8220;Create Family Member&#8221; through the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=575&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The new Xbox Live family pack is a great idea. Just be aware if you have existing Gamertags to add, you can only do that through a console (currently). You need to have all the profiles on the same console (temporarily; just a memory stick will do). <span style="text-decoration:underline;">Don&#8217;t be tempted</span> to &#8220;Create Family Member&#8221; through the <a title="Xbox Live Family Center" href="http://live.xbox.com/en-US/FamilyCenter" target="_blank">Family Center</a> page at http://www.xbox.com <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Doing so will create new Gold accounts, which count against an annual add/remove limit on the pack. These don&#8217;t expire for a year <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  The unfortunate solution is to cancel your Family Pack (which seems to temporarily return the accounts to Silver/Free status &#8211; ugh <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  ), then re-buy it (making sure you chase up any remaining-time credit you may &#8220;lose&#8221; in the process).</p>
<p>Other than that, $99/year for 4 Gold accounts is a nice deal <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Update 1</strong>: Canceling the pack isn&#8217;t a sure fix <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  (they&#8217;re looking into it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).<br />
<strong>Update 2</strong>: Others with same issue - <a title="I'm not the only crazy one :)" href="http://forums.xbox.com/34945194/ShowPost.aspx#34945194" target="_blank">http://forums.xbox.com/34945194/ShowPost.aspx#34945194</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/575/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=575&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2010/11/05/xbox-live-family-pack-be-careful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>
	</item>
		<item>
		<title>A Real WPF 4.0 WebBrowser</title>
		<link>http://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/</link>
		<comments>http://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 04:44:26 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/</guid>
		<description><![CDATA[UPDATE: Be sure to check out the .NET wrapper now included with Awesomium! I’ve updated my WPF Chromium WebBrowser for .NET 4.0 and Awesomium 1.6 RC1.&#160; You can find the source code here on CodePlex. Cjc.ChromiumBrowserDemo adds a couple of new features: Zoom in / out buttons. “Console” checkbox – Shows a console allowing you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=551&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong> Be sure to check out the <a href="http://labs.awesomium.com/category/news/" target="_blank">.NET wrapper now included with Awesomium</a>!</p>
<p>I’ve updated my <a title="A Real WPF WebBrowser (.NET 3.5)" href="http://chriscavanagh.wordpress.com/2009/08/25/a-real-wpf-webbrowser/" target="_blank">WPF Chromium WebBrowser</a> for .NET 4.0 and Awesomium 1.6 RC1.&#160; You can find the source code <a title="WPF 4.0 Chromium WebBrowser" href="http://wpfchromium4.codeplex.com/" target="_blank">here on CodePlex</a>.</p>
<p><a title="Cjc.ChromiumBrowserDemo source" href="http://wpfchromium4.codeplex.com/SourceControl/changeset/view/3284#77509" target="_blank">Cjc.ChromiumBrowserDemo</a> adds a couple of new features:</p>
<ul>
<li>Zoom in / out buttons. </li>
<li>“Console” checkbox – Shows a console allowing you to execute arbitrary javascript on the page. </li>
</ul>
<p><a href="http://chriscavanagh.files.wordpress.com/2010/10/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://chriscavanagh.files.wordpress.com/2010/10/image_thumb2.png?w=476&#038;h=462" width="476" height="462" /></a></p>
<p>It currently has a few known issues:</p>
<ul>
<li>Resizing the page (either directly or while rotating) can cause some flicker.&#160; This should be improved by an upcoming Awesomium tweak. </li>
<li>Some javascript can cause the console to “die” and ignore subsequent statements.&#160; Don’t use “document” or “window” on their own.&#160; However it appears safe to use things like this:
<p><font size="1" face="Courier New">document.getElementById( ‘myElement’ ).style.background = ‘red’</font> </li>
</ul>
<p>To build the solution, make sure you also download <a title="Awesomium 1.6 RC1" href="http://www.khrona.com/products/awesomium/download/" target="_blank">Awesomium 1.6 RC1</a> (<a title="Awesomium 1.6 RC1 - direct link at http://www.khrona.com" href="http://www.khrona.com/func/download/?id=19" target="_blank">direct link</a>) and place it in an Awesomium folder below the root.&#160; Your folders should look something like this:</p>
<p>Cjc.WpfChromium.4.0    <br />&#8211; Awesomium     <br />&#8212;- build     <br />&#8212;- docs     <br />&#8212;- include     <br />&#8212;- samples     <br />&#8211; Cjc.AwesomiumWrapper     <br />&#8211; Cjc.ChromiumBrowser     <br />&#8211; Cjc.ChromiumBrowserDemo     <br />&#8211; Cjc.WebSnapshot <strong><em>(optional)</em></strong></p>
<p>I’ll aim to post a new ClickOnce demo in the next few days.</p>
<p><img style="border-style:none;" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://chriscavanagh.files.wordpress.com/2010/10/wlemoticon-openmouthedsmile.png?w=490" /></p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/551/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=551&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/feed/</wfw:commentRss>
		<slash:comments>178</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2010/10/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2010/10/wlemoticon-openmouthedsmile.png" medium="image">
			<media:title type="html">Open-mouthed smile</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Photo Print updated</title>
		<link>http://chriscavanagh.wordpress.com/2010/09/03/wpf-photo-print-updated/</link>
		<comments>http://chriscavanagh.wordpress.com/2010/09/03/wpf-photo-print-updated/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 03:51:11 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2010/09/03/wpf-photo-print-updated/</guid>
		<description><![CDATA[I’ve had some requests to add basic “Save” functionality to my WPF Photo Print utility.&#160; It’s exceptionally quirky, but it gets the job done &#160; A few notes… Like the print functionality, it’ll only let you save images that are checked.&#160; If you use the File –&#62; Save as option, it’ll save the currently selected [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=545&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve had some requests to add basic “Save” functionality to my <a title="WPF Photo Print" href="http://chriscavanagh.wordpress.com/2008/07/29/wpf-photo-print/" target="_blank">WPF Photo Print</a> utility.&#160; It’s exceptionally quirky, but it gets the job done <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#160; A few notes…</p>
<ul>
<li>Like the print functionality, it’ll only let you save images that are checked.&#160; If you use the File –&gt; Save as option, it’ll save the currently selected <strong>and</strong> checked file.&#160; If you use the Save and Export –&gt; Save option, it’ll save all checked images. </li>
<li>Files aren’t saved with the name you tell it to use <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#160; Since it can save a batch of files, it gives each one a name based on the name you specify combined with the original name.&#160; So if your original is called Original.jpg and you save the edited image as MyNew.jpg, the result will be MyNew_Original.jpg.&#160; Totally weird but I didn’t want to give it too much thought just yet. </li>
<li>It scales saved images to fit an [arbitrarily sized] 3000 x 3000 box, retaining the required aspect ratio.&#160; This could be improved (so it could figure out an appropriate size based on the original size and transforms you applied), but I decided to leave that as a later exercise. </li>
<li>It requires .NET 4.0 or above (if using ClickOnce link, it might install that for you if needed). </li>
</ul>
<p>The <a title="CJC WPF Photo Print (ClickOnce)" href="http://www.chriscavanagh.com/chris/CjcPhotoPrint/publish.htm" target="_blank">ClickOnce app</a> is available <a title="CJC WPF Photo Print (ClickOnce)" href="http://www.chriscavanagh.com/chris/CjcPhotoPrint/publish.htm" target="_blank">here</a>, and the source is on <a title="CJC WPF Photo Print on CodePlex" href="http://wpfphotoprint.codeplex.com/SourceControl/list/changesets" target="_blank">CodePlex</a> as usual.</p>
<p><a title="CJC WPF Photo Print (ClickOnce)" href="http://www.chriscavanagh.com/chris/CjcPhotoPrint/publish.htm" target="_blank"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://chriscavanagh.files.wordpress.com/2010/09/image.png?w=503&#038;h=387" width="503" height="387" /></a></p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2010/09/03/wpf-photo-print-updated/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/09/03/wpf-photo-print-updated/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/545/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=545&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2010/09/03/wpf-photo-print-updated/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2010/09/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/09/03/wpf-photo-print-updated/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
		<item>
		<title>JelloPhone for Windows Phone 7</title>
		<link>http://chriscavanagh.wordpress.com/2010/08/09/jellophone-for-windows-phone-7/</link>
		<comments>http://chriscavanagh.wordpress.com/2010/08/09/jellophone-for-windows-phone-7/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 16:21:42 +0000</pubDate>
		<dc:creator>Chris Cavanagh</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">https://chriscavanagh.wordpress.com/2010/08/09/jellophone-for-windows-phone-7/</guid>
		<description><![CDATA[UPDATE: Added missing Cjc.Silverlight.JelloPhysics project to CodePlex I’ve finally put source code for my Windows Phone 7 Soft-Body Physics demo on CodePlex!&#160; As a bonus it runs much faster with the current emulator.&#160; You can get it here<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=537&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong> Added missing Cjc.Silverlight.JelloPhysics project to CodePlex <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I’ve finally put source code for my Windows Phone 7 <a href="http://chriscavanagh.wordpress.com/2010/03/23/soft-body-physics-for-windows-phone-7/" target="_blank">Soft-Body Physics demo</a> on <a href="http://jellophone.codeplex.com/" target="_blank">CodePlex</a>!&#160; As a bonus it runs much faster with the current emulator.&#160; You can get it <a href="http://jellophone.codeplex.com/SourceControl/list/changesets" target="_blank">here</a> <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://jellophone.codeplex.com/SourceControl/list/changesets"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://chriscavanagh.files.wordpress.com/2010/08/image1.png?w=473&#038;h=878" width="473" height="878" /></a></p>
<div class="wlWriterHeaderFooter" style="text-align:left;margin:0;padding:4px;"><a href="http://www.dotnetkicks.com/kick/?url=https://chriscavanagh.wordpress.com/2010/08/09/jellophone-for-windows-phone-7/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/08/09/jellophone-for-windows-phone-7/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chriscavanagh.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chriscavanagh.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chriscavanagh.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chriscavanagh.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chriscavanagh.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chriscavanagh.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chriscavanagh.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chriscavanagh.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chriscavanagh.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chriscavanagh.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chriscavanagh.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chriscavanagh.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chriscavanagh.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chriscavanagh.wordpress.com/537/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chriscavanagh.wordpress.com&amp;blog=313491&amp;post=537&amp;subd=chriscavanagh&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chriscavanagh.wordpress.com/2010/08/09/jellophone-for-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b8858c8a6022411fc9d48c1f4963928?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Chris</media:title>
		</media:content>

		<media:content url="http://chriscavanagh.files.wordpress.com/2010/08/image1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=https://chriscavanagh.wordpress.com/2010/08/09/jellophone-for-windows-phone-7/&#38;bgcolor=0080C0&#38;fgcolor=FFFFFF&#38;border=000000&#38;cbgcolor=D4E1ED&#38;cfgcolor=000000" medium="image">
			<media:title type="html">DotNetKicks Image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
