<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Mehfuz's WebLog</title><link>http://weblogs.asp.net/mehfuzh/default.aspx</link><description>Dont be a borg, harvest ideas and let your creativity shine.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><creativeCommons:license>http://creativecommons.org/licenses/by/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/burncsharp" type="application/rss+xml" /><feedburner:emailServiceId>burncsharp</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fburncsharp" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fburncsharp" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fburncsharp" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/burncsharp" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fburncsharp" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fburncsharp" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.yourminis.com/subscribe.aspx?u=http%3A%2F%2Ffeeds.feedburner.com%2Fburncsharp" src="http://www.yourminis.com/images/addtoyourminisbadge.gif">Subscribe with Yourminis.com</feedburner:feedFlare><feedburner:feedFlare href="http://www.flurry.com/pushRssFeed.do?r=fb&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2Fburncsharp" src="http://www.flurry.com/images/flurry_rss_logo2.gif">Subscribe with Flurry</feedburner:feedFlare><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Configuring Team build using XUnit [From client] – Update.</title><link>http://feedproxy.google.com/~r/burncsharp/~3/CggiIAWnRAc/configuring-team-build-using-xunit-from-client-update.aspx</link><pubDate>Sat, 05 Sep 2009 08:05:47 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7192828</guid><dc:creator>mehfuzh</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=7192828</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=7192828</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/09/05/configuring-team-build-using-xunit-from-client-update.aspx#comments</comments><description>&lt;p&gt;In my previous post , i mentioned about configuring Team build along with XUnit without installing anything on the build machine. This is sometimes useful as the build machine is miles away and is shared among other projects&amp;#160; and you don’t want to mess things up installing your stuffs.&lt;/p&gt;  &lt;p&gt;Now, inside the &lt;strong&gt;TeamBuildTypes&lt;/strong&gt; folder you can add your referenced dlls which you can use in your MSBuild target file to do automated test, which is on the other hand is referenced in TFSBuild.Proj file.&lt;/p&gt;  &lt;p&gt;Now, It’s fine, but let’s say i want to organize my folders a little bit and occasionally want to drop the docs along with current build&amp;#160; from the source or any other folder that is necessary. To do so, we can visually customize it from &lt;em&gt;Builds –&amp;gt; My Build –&amp;gt; Edit Build Definition –&amp;gt; Workspaces&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/BuildWorkspace_6B01B8CB.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BuildWorkspace" border="0" alt="BuildWorkspace" src="http://weblogs.asp.net/blogs/mehfuzh/BuildWorkspace_thumb_66C7BB39.png" width="582" height="415" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here, &lt;em&gt;MyRoot&lt;/em&gt; is the root in my TFS setup where &lt;em&gt;MyFolder&lt;/em&gt; is the one under which i have &lt;em&gt;CodeBase, Build, Help , &lt;/em&gt;etc. By default, as sources get into a temp folder before the build starts , all the files from solution directory will be get and is entered under workspace folders automatically as you select your project file.&amp;#160; But if you want to get a Help file or reference assembly , in this case&amp;#160; XUnit MsBuild dlls then you have to specify it in this wizard, if you don’t want to have them under TeamBuildTypes/MyDefinationName folder.&lt;/p&gt;  &lt;p&gt;Finally, from the previous XUniBuild.Targets our reference path will change like:&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;UsingTask&lt;/span&gt;  &lt;span class="attr"&gt;AssemblyFile&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;$(SolutionRoot)\MyFolder\Build\xunit.runner.msbuild.dll&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;   &lt;span class="attr"&gt;TaskName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Xunit.Runner.MSBuild.xunit&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&amp;#160;&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;Or copy docs from&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;&amp;#160;&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Copy&lt;/span&gt; &lt;span class="attr"&gt;SourceFiles&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;$(SolutionRoot)\MyFolder\Help\MyDoc.docx&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;DestinationFiles&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;$(OutDir)\Docs\MyDoc.docx&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Here , $(SolutionRoot) is the temp folder where items to be get according to the&amp;#160; workspace setup, where you can add/ modify items as you want and you can also see how its going from BuildLog that is dropped after each build to the root of your drop folder.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;If you missed the previous post , here it is again:&lt;/p&gt;

&lt;p&gt;&lt;a title="http://weblogs.asp.net/mehfuzh/archive/2009/08/25/configuring-team-build-using-xunit.aspx" href="http://weblogs.asp.net/mehfuzh/archive/2009/08/25/configuring-team-build-using-xunit.aspx"&gt;http://weblogs.asp.net/mehfuzh/archive/2009/08/25/configuring-team-build-using-xunit.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Hope that helps&lt;/p&gt;

&lt;p&gt;&lt;a href="http://dotnetshoutout.com/Configuring-Team-build-using-XUnit-From-client-Update-Mehfuzs-WebLog" rev="vote-for"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fweblogs.asp.net%2Fmehfuzh%2Farchive%2F2009%2F09%2F05%2Fconfiguring-team-build-using-xunit-from-client-update.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7192828" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=CggiIAWnRAc:Blh3JwowMXA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=CggiIAWnRAc:Blh3JwowMXA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=CggiIAWnRAc:Blh3JwowMXA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=CggiIAWnRAc:Blh3JwowMXA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?i=CggiIAWnRAc:Blh3JwowMXA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/CggiIAWnRAc" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Unit+Test/default.aspx">Unit Test</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/MSBuild/default.aspx">MSBuild</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Team+system/default.aspx">Team system</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/09/05/configuring-team-build-using-xunit-from-client-update.aspx</feedburner:origLink></item><item><title>Configuring Team build using XUnit [From Client]</title><link>http://feedproxy.google.com/~r/burncsharp/~3/lr3hNkPTsmU/configuring-team-build-using-xunit.aspx</link><pubDate>Tue, 25 Aug 2009 13:48:49 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7180992</guid><dc:creator>mehfuzh</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=7180992</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=7180992</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/08/25/configuring-team-build-using-xunit.aspx#comments</comments><description>&lt;p&gt;Recently, while i was setting up TFS build [to enable CI] for a project at Telerik that i am currently working on, i came across configuring it up with XUnit for doing automated tests every time someone checks-in source code after the build process is complete using the Xunit MsBuild task and additionally it will print the build steps so that developer knows what’s the issue.&lt;/p&gt;  &lt;p&gt;Now, to layout a little bit of background. When you setup a “New build Definition” from Team Explorer – &amp;gt; Builds . TFS actually drops a&amp;#160; TFSBuild.proj under&amp;#160; “$/ProjectName/TeamBuidTypes/BuildDefinationName/” folder . This is nothing but a regular &lt;em&gt;MSBuild&lt;/em&gt; file that defines how and where your project should be built and dropped and how it will be tested.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/image_532C3E83.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/image_thumb_5FF66ED4.png" width="544" height="271" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;TFS gives out of the box support for VSTests , but for other types you need to do a little bit of configuration.When you do a &lt;em&gt;check-in[If build process is setup to fire for each check-in],&lt;/em&gt;first TFS does a GET operation from /TeamBuildTypes/BuildDefinationName/ and after that it starts executing as things are defined in TFSBuild.proj. In the pasted &lt;em&gt;Team explorer &lt;/em&gt;snap you can see that i have added a target file named “XunitBuild.targets”. It is referenced in &lt;em&gt;TFSBuild.proj&amp;#160; &lt;/em&gt;somewhere above the &amp;lt;itemGroup&amp;gt;&lt;em&gt;&amp;#160;&lt;/em&gt;like &lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Import&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Project&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(MSBuildProjectDirectory)\XUnitBuild.targets&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;To use &lt;em&gt;xunit&lt;/em&gt; task we need to include the following two assemblies in same folder with TFSBuild.proj.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;xunit.runner.msbuild.dll &lt;/li&gt;

  &lt;li&gt;xunit.runner.utiliy.dll &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Inside &lt;em&gt;XUnitBuild.targets&lt;/em&gt;, first of all we need to reference the task. Just to mention that assembly file path will be preceded by a folder path where &lt;em&gt;TFSBuild.proj&lt;/em&gt; is stored though GET operation.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;UsingTask&lt;/span&gt;  &lt;span style="color: #ff0000"&gt;AssemblyFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;xunit.runner.msbuild.dll&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;    &lt;span style="color: #ff0000"&gt;TaskName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Xunit.Runner.MSBuild.xunit&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Next, we need to hook the task under specific target that will be invoked by TFS automatically. TFS has some predefined targets that are fired at different steps of the build process, we can hook them to perform some custom tasks before, during or after each step is completed.&lt;/p&gt;

&lt;p&gt;Some of the targets are :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;AfterCompile &lt;/li&gt;

  &lt;li&gt;BeforeTest &lt;/li&gt;

  &lt;li&gt;CoreTest &lt;/li&gt;

  &lt;li&gt;AfterTest &lt;/li&gt;

  &lt;li&gt;AfterDropBuild &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can get the full list from &lt;em&gt;MSDN &lt;/em&gt;but i would rather leave it up to you as it is not the main topic here. Moving forward, i have hooked &lt;em&gt;CoreTest &lt;/em&gt;Target [ set Name=”CoreTest”]. Inside it, i created a build step that will print if tests are successful or failed depending on the result returned by &lt;em&gt;xunit&lt;/em&gt; task.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;BuildStep&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;            &lt;span style="color: #ff0000"&gt;TeamFoundationServerUrl&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(TeamFoundationServerUrl)&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;            &lt;span style="color: #ff0000"&gt;BuildUri&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(BuildUri)&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;            &lt;span style="color: #ff0000"&gt;Message&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Preparing to test...&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Id&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PropertyName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;StepId&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;BuildStep&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;On first run &lt;em&gt;BuildStep&lt;/em&gt; task will produce an &lt;em&gt;Id&lt;/em&gt; that will be stored in a property which will be used later to print test status.&amp;#160; &lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;xunit&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ContinueOnError&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Assembly&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(OutDir)\Sample.Tests.dll&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Verbose&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ExitCode&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PropertyName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Result&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;xunit&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Executing &lt;strong&gt;&lt;em&gt;xunit&lt;/em&gt; &lt;/strong&gt;task requires the assembly path for tests to perform on,&amp;#160; additionally you can specify it to be verbose and finally can store the return code in a property for further checks. Here, i have also specified “ContinueOnError=true” as for any failure, things will be handled manually.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;BuildStep&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Condition&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;'$(Result)'=='0'&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TeamFoundationServerUrl&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(TeamFoundationServerUrl)&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;              &lt;span style="color: #ff0000"&gt;BuildUri&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(BuildUri)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(StepId)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Status&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Succeeded&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Message&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Test succeeded.&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;BuildStep&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Condition&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;'$(Result)'!='0'&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TeamFoundationServerUrl&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(TeamFoundationServerUrl)&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;              &lt;span style="color: #ff0000"&gt;BuildUri&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(BuildUri)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(StepId)&amp;quot;&lt;/span&gt;  &lt;span style="color: #ff0000"&gt;Status&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Failed&amp;quot;&lt;/span&gt;  &lt;span style="color: #ff0000"&gt;Message&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Test Failed.&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Error&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Condition&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;'$(Result)'!='0'&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Test failed.&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Above two &lt;em&gt;BuildStep&lt;/em&gt; tasks&amp;#160; will print test status depending on the result set by &lt;em&gt;xunit&lt;/em&gt; task for previously created step and followed by &lt;em&gt;Error&lt;/em&gt; task will fail the build for same.&amp;#160; Finally, when we will be expanding the build explorer, list will contain the custom step where build status will be determined from the error condition.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/image_44CDADC5.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/image_thumb_726B0523.png" width="589" height="79" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;That’s it and here goes the target file &lt;a href="http://weblogs.asp.net/blogs/mehfuzh/Targets_02157486.zip" target="_blank"&gt;XUnitBuild.zip&lt;/a&gt; . I actually &lt;strong&gt;binged&lt;/strong&gt; it out and covered all together in one place so that it saves a little time of yours so feel free to suggest anything that comes to your mind.&lt;/p&gt;

&lt;p&gt;Enjoy !!!&lt;/p&gt;
&lt;a href="http://dotnetshoutout.com/Configuring-Team-build-using-XUnit-Mehfuzs-WebLog" rev="vote-for"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fweblogs.asp.net%2Fmehfuzh%2Farchive%2F2009%2F08%2F25%2Fconfiguring-team-build-using-xunit.aspx" /&gt;&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7180992" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=lr3hNkPTsmU:dp_30J7YFDg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=lr3hNkPTsmU:dp_30J7YFDg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=lr3hNkPTsmU:dp_30J7YFDg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=lr3hNkPTsmU:dp_30J7YFDg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?i=lr3hNkPTsmU:dp_30J7YFDg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/lr3hNkPTsmU" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Unit+Test/default.aspx">Unit Test</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/MSBuild/default.aspx">MSBuild</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Team+system/default.aspx">Team system</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/08/25/configuring-team-build-using-xunit.aspx</feedburner:origLink></item><item><title>Introducing LINQ to M</title><link>http://feedproxy.google.com/~r/burncsharp/~3/7Pvqgv5Vr80/introducing-linq-to-m.aspx</link><pubDate>Sun, 19 Jul 2009 08:14:45 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7150674</guid><dc:creator>mehfuzh</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=7150674</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=7150674</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/07/19/introducing-linq-to-m.aspx#comments</comments><description>&lt;div id="codeSnippetWrapper"&gt;Now , it happens that you go to McDonalds website and order an item for you. It could happen that price of the menu changed or new one comes to the menu. Now, generally it can happen that admin can go though wizard and loads of textboxes or dropdowns to make the changes or he/she can just write as if he/she is writing in some text editor and everything else is taken care of on behalf. Textual DSL is a powerful tool that might become the future of how we communicate to computer systems. Well, things are not that easy to convert human language to machine readable forms completely but its not bad to dream for the best :-).&lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div&gt;In this post, i will show how you can change items using&amp;#160; M and then bind it to a data grid using LINQ query. I will do it using sample data that shows price menu for Mc burgers.&lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div&gt;Our first step is to define a constant that holds the M value format.&lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div id="codeSnippet" class="csharpcode"&gt;     &lt;div id="codeSnippetWrapper"&gt;       &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;         &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; MGraphCode = &lt;span style="color: #006080"&gt;@&amp;quot;Burgers&lt;/pre&gt;
&lt;!--CRLF--&gt;

        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {   &lt;/pre&gt;
&lt;!--CRLF--&gt;

        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;    { Code=&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;DCB001&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;,Name=&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;Double Cheese Burger&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;,Quantity=1,Price=5},&lt;/pre&gt;
&lt;!--CRLF--&gt;

        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;    { Code=&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;Mc001&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;,Name=&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;Mc Chicken&amp;quot;&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot;,Quantity=1,Price=4}&lt;/pre&gt;
&lt;!--CRLF--&gt;

        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; }&amp;quot;&lt;/span&gt;; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Next, you need to load the grammar using the QueryContext :&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; var mcContext = QueryContext.Instance.Load(MGraphCode);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;And, finally need to bind it to a data grid,&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; gridView1.DataSource = mcContext;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; gridView1.DataBind();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now, this for when you are just getting your data and binding it to the grid without any type of filters, to use filter let’s construct a class around the items, let’s call it &lt;em&gt;&lt;u&gt;McBurger&lt;/u&gt;&lt;/em&gt;, actually&amp;#160; internally it infers to the class that we have defined rather building a anonymous type.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; McBurger &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Code {get;set;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name { get; set; }   &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Quantity { get; set; }  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;float&lt;/span&gt; Price { get;set;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Accordingly, you can use LINQ statement to do it like&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; var mcContext= QueryContext.Instance.Load&amp;lt;McBurger&amp;gt;(MGraphCode);   &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; var query = from mcBurger &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; mcContext&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; mcBurger.Code == &lt;span style="color: #006080"&gt;&amp;quot;Mc001&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;             select mcBurger;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: #008000"&gt;// rest of the databinding code remains the same.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;

&lt;p&gt;So, we took the context and queried for specific menu and data grid binding remains the same which brings an output like&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/IntroducingLINQtoM_12214/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/IntroducingLINQtoM_12214/image_thumb.png" width="240" height="99" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Actually, &lt;a href="http://www.stephenforte.net/" target="_blank"&gt;Steve&lt;/a&gt; and I are pretty excited about this, the possibility of doing things with M is almost endless. Steve has made a more detail post on this and you can find it right at &lt;a href="http://www.stephenforte.net/Default.aspx#abd174995-58d0-4713-8ce0-b4ce452c5951" target="_blank"&gt;LINQ to M is available&lt;/a&gt;.&amp;#160; You can also download the library as well as the sample from Telerik labs and it points to &lt;a href="http://www.telerik.com/community/labs/telerik-linq-to-m.aspx" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Finally, you can download the example that i have shown from&amp;#160; &lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/IntroducingLINQtoM_12214/LINQ2MDemo.zip" target="_blank"&gt;here&lt;/a&gt;.&amp;#160; You will be needing Oslo May CTP to run this sample.&lt;/p&gt;

&lt;p&gt;Hope that helps&lt;/p&gt;
&lt;a href="http://dotnetshoutout.com/Introducing-LINQ-to-M-Mehfuzs-WebLog" rev="vote-for"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fweblogs.asp.net%2Fmehfuzh%2Farchive%2F2009%2F07%2F19%2Fintroducing-linq-to-m.aspx" /&gt;&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7150674" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=7Pvqgv5Vr80:JIaQUTUaYNc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=7Pvqgv5Vr80:JIaQUTUaYNc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=7Pvqgv5Vr80:JIaQUTUaYNc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=7Pvqgv5Vr80:JIaQUTUaYNc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?i=7Pvqgv5Vr80:JIaQUTUaYNc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/7Pvqgv5Vr80" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Oslo/default.aspx">Oslo</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/07/19/introducing-linq-to-m.aspx</feedburner:origLink></item><item><title>Operation could destabilize the runtime – Reflection.Emit and common pitfalls</title><link>http://feedproxy.google.com/~r/burncsharp/~3/2MFAtbBnT64/operation-could-destabilize-the-runtime-reflection-emit-and-common-pitfalls.aspx</link><pubDate>Sun, 07 Jun 2009 09:14:43 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7111205</guid><dc:creator>mehfuzh</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=7111205</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=7111205</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/06/07/operation-could-destabilize-the-runtime-reflection-emit-and-common-pitfalls.aspx#comments</comments><description>&lt;p&gt;In the last post i said about LinqtExtender implementing necessary property and injecting specific settings for entity objects. The issue i have is that it works fine under full / high trust settings but when running in medium trust it gives the following error:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Operationcoulddest.Emitandcommonpitfalls_C63B/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Operationcoulddest.Emitandcommonpitfalls_C63B/image_thumb.png" width="484" height="300" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Ouch.. it is only happening while i am using the extender from medium trust environment. As to add a little prologue, actually it creates a proxy around your original entity and if you look closely it is giving the error in &lt;strong&gt;.ctor()&lt;/strong&gt;. Now lets dig in.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; ILGenerator ilGenerator = constructorBuilder.GetILGenerator();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; ConstructorInfo baseConstructor = &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;).GetConstructors()[0];&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; ilGenerator.Emit(OpCodes.Ldarg_0);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; ilGenerator.Emit(OpCodes.Call, baseConstructor);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; ilGenerator.Emit(OpCodes.Ret);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The IL code is pretty simple actually , its the method body of the proxy class constructor that calls default constructor of the base class. Now, this will work fine in full/high trust as here i require the entity class to have a default constructor. But, as i switch the mode to medium trust it will throw me the above exception. The reason why, in medium trust the framework verifies the IL generated and though it may seem from my point of view that its a valid IL as it is expecting default constructor , to framework’s context its invalid as the base object might never have any default constructor (it should throw error in high trust). In that case the call is absolutely suspicious duh…&lt;/p&gt;

&lt;p&gt;So the valid block for this scenario would be:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; ILGenerator ilGenerator = constructorBuilder.GetILGenerator();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; ConstructorInfo baseConstructor = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; ConstructorInfo[] constructorInfos = parent.GetConstructors();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; containsDefaultConstructor = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (ConstructorInfo info &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; constructorInfos)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (info.GetParameters().Length == 0)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         baseConstructor = info;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         containsDefaultConstructor = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!containsDefaultConstructor)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Exception(Properties.Messages.MustHaveADefaultConstructor);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt; ilGenerator.Emit(OpCodes.Ldarg_0);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt; ilGenerator.Emit(OpCodes.Call, baseConstructor);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt; ilGenerator.Emit(OpCodes.Ret);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The code is similar , just it checks for a default constructor , if not throws a valid exception and to medium trust everything looks fine.&amp;#160; I have added a patch for extender with this as well, do check it out.&lt;/p&gt;

&lt;p&gt;Finally, while you are doing &lt;em&gt;Reflection.Emit&lt;/em&gt; do check this and more like, you should not emit any unmanaged code and even not play around with private stuffs , etc to avoid pitfalls.&lt;/p&gt;

&lt;p&gt;Hope that helps&lt;/p&gt;
&lt;a href="http://dotnetshoutout.com/Operation-could-destabilize-the-runtime-ReflectionEmit-and-common-pitfalls-Mehfuzs-WebLog" rev="vote-for"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fweblogs.asp.net%2Fmehfuzh%2Farchive%2F2009%2F06%2F07%2Foperation-could-destabilize-the-runtime-reflection-emit-and-common-pitfalls.aspx" /&gt;&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7111205" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=2MFAtbBnT64:gMqzfEZmGX8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=2MFAtbBnT64:gMqzfEZmGX8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=2MFAtbBnT64:gMqzfEZmGX8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=2MFAtbBnT64:gMqzfEZmGX8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?i=2MFAtbBnT64:gMqzfEZmGX8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/2MFAtbBnT64" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/MSIL/default.aspx">MSIL</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/06/07/operation-could-destabilize-the-runtime-reflection-emit-and-common-pitfalls.aspx</feedburner:origLink></item><item><title>Extending your existing API or legacy data classes to support LINQ</title><link>http://feedproxy.google.com/~r/burncsharp/~3/yIsfNSpqn20/extending-your-existing-api-or-legacy-data-classes-to-support-linq.aspx</link><pubDate>Sat, 06 Jun 2009 08:10:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7109480</guid><dc:creator>mehfuzh</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=7109480</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=7109480</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/06/06/extending-your-existing-api-or-legacy-data-classes-to-support-linq.aspx#comments</comments><description>&lt;P&gt;While developing LinqExtender, i have come across various scenarios that people don’t want to extent any query class or even implement any interface. Also, it is almost absurd when they have to add new extender specific attributes to their entity class. It is though not very important for people creating new provider with small codebase but with large codebase it soon becomes a pain to modify each class.&lt;/P&gt;
&lt;P&gt;The solution is to make Extender as a container , which is people will write their logic to act on their specific entity or list of entities, also define their settings via fluent interface. To wrap it around , there is a basic ORM that comes with the extender pack and i have a made LibraryContext on top of SqlQueryContext&amp;lt;T&amp;gt;. Inside, the constructor i wrote the following code to define the extender specific settings.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; Extender&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt;     .Settings&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum3&gt;   3:&lt;/SPAN&gt;         .For&amp;lt;Base&amp;gt;()&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum4&gt;   4:&lt;/SPAN&gt;         .Begin&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum5&gt;   5:&lt;/SPAN&gt;             .Property(x =&amp;gt; x.Id).MarkAsUnique&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum6&gt;   6:&lt;/SPAN&gt;         .End&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum7&gt;   7:&lt;/SPAN&gt;         .For&amp;lt;Book&amp;gt;()&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum8&gt;   8:&lt;/SPAN&gt;         .MapToEntity(&lt;SPAN style="COLOR: #006080"&gt;"book"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum9&gt;   9:&lt;/SPAN&gt;         .Begin&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum10&gt;  10:&lt;/SPAN&gt;             .Property(x =&amp;gt; x.Id).MapToAttribute(&lt;SPAN style="COLOR: #006080"&gt;"Bk_Id"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum11&gt;  11:&lt;/SPAN&gt;             .Property(x =&amp;gt; x.ShelveId).MapToAttribute(&lt;SPAN style="COLOR: #006080"&gt;"Shelve_Id"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum12&gt;  12:&lt;/SPAN&gt;             .Property(x =&amp;gt; x.Title).MapToAttribute(&lt;SPAN style="COLOR: #006080"&gt;"Bk_Title"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum13&gt;  13:&lt;/SPAN&gt;             .Property(x =&amp;gt; x.BookInfo).MarkToIgnore()&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum14&gt;  14:&lt;/SPAN&gt;         .End&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum15&gt;  15:&lt;/SPAN&gt;         .For&amp;lt;Library&amp;gt;()&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum16&gt;  16:&lt;/SPAN&gt;         .MapToEntity(&lt;SPAN style="COLOR: #006080"&gt;"Bk_Library"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum17&gt;  17:&lt;/SPAN&gt;     .InstantiateIn(&lt;SPAN style="COLOR: #0000ff"&gt;this&lt;/SPAN&gt;);    &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Note that there is a &lt;EM&gt;base &lt;/EM&gt;settings that will be applied to all the common properties under my project and is a local class inherited from LinqExtender.Configruation.All. During the instantiation it will be applied to the current container instance.&lt;/P&gt;
&lt;P&gt;Now, as i have said extender should be used a container so that there should be no strings attached. In my entity class, i can implement IQueryObject to mark it as a query class, but if not then extender should be smarter enough to implement it internally when the entity is used in LINQ query via extender query class. Actually , under the hood it dynamically creates a proxy via &lt;EM&gt;Reflection.Emit&lt;/EM&gt; that has the settings and ensures &lt;EM&gt;IQueryObject. &lt;/EM&gt;I will in days time come out with a open source project where i have practiced all these reflection stuffs and which i will extensively blog about , so stay tuned.&lt;/P&gt;
&lt;P&gt;To make it more clear i have re-implemented the LINQ to Twitter post using the new extender. So few things like implementing IQueryObject and defining unique identifier is no longer required. You can get the new copy at the end of the post.&lt;STRIKE&gt; Also, before i forget, there is a tiny catch which is you can’t left the extender auto generate settings, if you are using it in medium-trust as &lt;EM&gt;Reflection.Emit&lt;/EM&gt; does not work in such environment. In that case you will have to implement IQueryObject by hand and add the attributes manually to make it work so i am leaving LinqToTwitter post untouched &lt;/STRIKE&gt;[See bottom]. I know most of the good hosting providers these days support high trust and soon i think medium trust will become classic with dynamic proxy generation and cross domain request is becoming growing common (Just my two cents, don't want to get in war with these ;)).&lt;/P&gt;
&lt;P&gt;In previous release you can access the Fluent implementation of Bucket just by &lt;EM&gt;Bucket.Instance&lt;/EM&gt;, as it seems that i have somewhere statically stored the bucket object and the syntax bit more sexy but considering multiple threads , there is a possibility of data corruption. Therefore Bucket instance is passed to Query&amp;lt;T&amp;gt; overrides as IBucket and new syntax for Bucket.Instance follows&lt;/P&gt;
&lt;DIV id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; FluentBucket fluentBucket = FluentBucket.As(bucket);&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt; // &lt;SPAN style="COLOR: #0000ff"&gt;do&lt;/SPAN&gt; your work.&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Down to acknowledgement , Microsoft Germany has published two new tutorials around LinqExtender using LinqToFlickr and LinqToTwitter that also led me fix the VB method call issue and thanks Lars and Tim. In German way i would say, “Danke[Dang – ko]”. You can find the recordings in the following URLs&lt;/P&gt;
&lt;P&gt;&lt;A title=http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33389 href="http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33389" target=_blank mce_href="http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33389"&gt;http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33389&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A title=http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33369 href="http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33369" target=_blank mce_href="http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33369"&gt;http://www.microsoft.com/germany/msdn/solve/codeclips/library.aspx?id=msdn_de_33369&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Finally, while we are preparing our new Sitefinity release and making some LINQ extensions, bob’s comments were helpful&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;shaping the release as well and nonetheless all community reviews and feedbacks are great. Try the new release &lt;A href="http://linqextender.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28187" target=_blank mce_href="http://linqextender.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28187"&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id=scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:ebe9906b-88ef-4dc9-bde1-fb6c0ca499c9 class=wlWriterEditableSmartContent&gt;
&lt;DIV&gt;Linq To Twitter Source : &lt;A href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/ExtendingyourexistingAPIorlegacydataclas_B075/LinqToTwitter_1.zip" target=_blank mce_href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/ExtendingyourexistingAPIorlegacydataclas_B075/LinqToTwitter_1.zip"&gt;LinqToTwitter.zip&lt;/A&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Enjoy !!!&lt;/P&gt;
&lt;P&gt;June 7, 2009 =&amp;gt; Correction ,&lt;EM&gt;Reflecton.Emit&lt;/EM&gt; does not&amp;nbsp;work in medium trust for unmanaged IL codes&amp;nbsp;and&amp;nbsp; possible IL that might destabilize the runtime that it finds by verifying the assembly, will show more on it in upcoming post.&amp;nbsp;Added a patch of extender, this will work in medium trust with auto implementaion and fluent configuration.&lt;/P&gt;&lt;A href="http://dotnetshoutout.com/Extending-your-existing-API-or-legacy-data-classes-to-support-LINQ-Mehfuzs-WebLog" rev=vote-for&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fweblogs.asp.net%2Fmehfuzh%2Farchive%2F2009%2F06%2F06%2Fextending-your-existing-api-or-legacy-data-classes-to-support-linq.aspx"&gt;&lt;/A&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7109480" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=yIsfNSpqn20:Pn7xGJI424g:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=yIsfNSpqn20:Pn7xGJI424g:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=yIsfNSpqn20:Pn7xGJI424g:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=yIsfNSpqn20:Pn7xGJI424g:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?i=yIsfNSpqn20:Pn7xGJI424g:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/yIsfNSpqn20" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LinqExtender/default.aspx">LinqExtender</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LinqToTwitter/default.aspx">LinqToTwitter</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/06/06/extending-your-existing-api-or-legacy-data-classes-to-support-linq.aspx</feedburner:origLink></item><item><title>Using of JSON Result in Asp.net MVC 1.0</title><link>http://feedproxy.google.com/~r/burncsharp/~3/6oXALYrHsPI/using-of-json-result-in-asp-net-mvc-1-0.aspx</link><pubDate>Tue, 28 Apr 2009 09:20:50 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7063244</guid><dc:creator>mehfuzh</dc:creator><slash:comments>9</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=7063244</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=7063244</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/04/28/using-of-json-result-in-asp-net-mvc-1-0.aspx#comments</comments><description>&lt;p&gt;In a post few month back , i showed how can i simulate a callback using JQuery and ASP.NET with my experimental FlickrXplorer project. More detail on this can be found at the following URL&lt;/p&gt;  &lt;p&gt;&lt;a title="http://weblogs.asp.net/mehfuzh/archive/2008/10/13/using-jquery-to-do-ajax-form-posts-in-asp-net-mvc.aspx" href="http://weblogs.asp.net/mehfuzh/archive/2008/10/13/using-jquery-to-do-ajax-form-posts-in-asp-net-mvc.aspx" target="_blank"&gt;http://weblogs.asp.net/mehfuzh/archive/2008/10/13/using-jquery-to-do-ajax-form-posts-in-asp-net-mvc.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now, what i have done here is basically, i did an AJAX call to the controller and rendered the view result in a div.&amp;#160; One thing about this way is that i am able to make the view strongly typed as i first rendered view using standard way with all the strongly type ViewData.Model. It is nice for rendering views with small amount of html in it (Like , tag lists), but slow for big outputs. The best practice for all these is to use the JSONResult. Here, i will show a small example of how i render the comment list in FlickrXplorer using JSON result and JQuery $.get in conjunction to make the AJAX request.&lt;/p&gt;  &lt;p&gt;First, let’s see how the controller looks like. Assume that there is a controller named &lt;em&gt;CommentController&lt;/em&gt; and we have an action named &lt;em&gt;List&lt;/em&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;[AcceptVerbs(HttpVerbs.Get)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult List(&lt;span class="kwrd"&gt;string&lt;/span&gt; photoId, &lt;span class="kwrd"&gt;int&lt;/span&gt; ? index, &lt;span class="kwrd"&gt;int&lt;/span&gt;? page)
{
    &lt;span class="kwrd"&gt;int&lt;/span&gt; skip = index == &lt;span class="kwrd"&gt;null&lt;/span&gt; ? 0 : index.Value*page.Value;
    &lt;span class="kwrd"&gt;int&lt;/span&gt; take = page == &lt;span class="kwrd"&gt;null&lt;/span&gt; ? &lt;span class="kwrd"&gt;int&lt;/span&gt;.MaxValue : page.Value;

    PhotoCommentViewData comments = &lt;span class="kwrd"&gt;new&lt;/span&gt; PhotoCommentViewData();

    &lt;span class="kwrd"&gt;try&lt;/span&gt;
    {
        comments = model.GetComments(photoId, skip, take, &lt;span class="kwrd"&gt;false&lt;/span&gt;);
        &lt;span class="kwrd"&gt;return&lt;/span&gt; Json(comments);
    }
    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)
    {
         &lt;span class="rem"&gt;/// do some exception tracking&lt;/span&gt;
    }
}&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;As it seems, it gets the list of comment from its underlying model and then pass it through &lt;strong&gt;JSON &lt;/strong&gt;result. Optionally, i limited that the action should only be accepting GET calls as it is a list request.&lt;/p&gt;

&lt;p&gt;Now, coming back to JavaScript we first need to do a GET request to this action and syntax for doing it in JQuery style:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;$.get(url, { index: index, page: page }, function(result) {

   processComments(url, result, &lt;strike&gt;index, page, loaderTarget, contentTarget&lt;/strike&gt;); [strike though is not covered in the post]

 }, &lt;span class="str"&gt;&amp;quot;json&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;style type="text/css"&gt;











.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;











.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The first argument is the comment list URL, this is constructed in server side using &lt;strong&gt;Url.Action&lt;/strong&gt; and then passed in the JS that also ensures the routing setup, second is the JSON string for params, third is the callback for the result it fetches and final is the type of response it should contain.&lt;/p&gt;

&lt;p&gt;Inside &lt;strong&gt;&lt;em&gt;processComments &lt;/em&gt;,&lt;/strong&gt; i basically do some DOM operations to build the necessary html block&lt;/p&gt;

&lt;pre class="csharpcode"&gt;$(&lt;span class="str"&gt;&amp;quot;#layout&amp;quot;&lt;/span&gt;)
    .append($(&lt;span class="str"&gt;&amp;quot;&amp;lt;tr/&amp;gt;&amp;quot;&lt;/span&gt;)
        .css({&lt;span class="str"&gt;&lt;span class="str"&gt;'vertical-align' : 'top'&lt;/span&gt;&lt;/span&gt;})
        .append($(&lt;span class="str"&gt;&amp;quot;&amp;lt;td/&amp;gt;&amp;quot;&lt;/span&gt;)
        .attr(&lt;span class="str"&gt;&amp;quot;class&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;said&amp;quot;&lt;/span&gt;)
        .append($(&lt;span class="str"&gt;&amp;quot;&amp;lt;strong/&amp;gt;&amp;quot;&lt;/span&gt;)
        .append($(&lt;span class="str"&gt;&amp;quot;&amp;lt;a/&amp;gt;&amp;quot;&lt;/span&gt;)
                .attr(&lt;span class="str"&gt;&amp;quot;href&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;/Photo/NsId/&amp;quot;&lt;/span&gt; + comment.Author)
                .css({ &lt;span class="str"&gt;'color'&lt;/span&gt;: &lt;span class="str"&gt;'#0063DC'&lt;/span&gt;, &lt;span class="str"&gt;'text-decoration'&lt;/span&gt;: &lt;span class="str"&gt;'none'&lt;/span&gt;})
                .append(comment.AuthorName))
            .append(&lt;span class="str"&gt;&amp;quot;&amp;amp;nbsp;says: &amp;quot;&lt;/span&gt;))
        .append($(&lt;span class="str"&gt;&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;&lt;/span&gt;))
        .append(comment.Text)));&lt;/pre&gt;

&lt;p&gt;So, there is a “layout” panel in the comment container where i am to add the dynamic html. jQuery has this nice way of adding html in a chain and elements under it. For example i want to render a html link with some custom CSS and i want to point that to some URL as well.&lt;/p&gt;

&lt;p&gt;Using jQuery , i would do&lt;/p&gt;

&lt;pre class="csharpcode"&gt;$(&lt;span class="str"&gt;&amp;quot;&amp;lt;a/&amp;gt;&amp;quot;&lt;/span&gt;)
 .attr(&lt;span class="str"&gt;&amp;quot;href&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;/Photo/NsId/&amp;quot;&lt;/span&gt; + comment.Author)
 .css({ &lt;span class="str"&gt;'color'&lt;/span&gt;: &lt;span class="str"&gt;'#0063DC'&lt;/span&gt;, &lt;span class="str"&gt;'text-decoration'&lt;/span&gt;: &lt;span class="str"&gt;'none'&lt;/span&gt; })
 .append(comment.AuthorName)&lt;/pre&gt;

&lt;p&gt;This will render a html tag something like&lt;/p&gt;

&lt;p&gt;&amp;lt;a href=”/photo/NsId/x@y” style=”color:#0063DC, text-decoration:none”&amp;gt;Mehfuz &amp;lt;/a&amp;gt;&lt;/p&gt;

&lt;p&gt;The rule is that you start a element with $(…) in XHTML style then add necessary attributes, styles and text and it will automatically give you a well-formed html,&amp;#160; moreover you can nest it as you like with other elements.&lt;/p&gt;

&lt;p&gt;The above block finally produces a look similar to&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/UsingofJSONResultinAsp.netMVC1.0_BFA5/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/UsingofJSONResultinAsp.netMVC1.0_BFA5/image_thumb.png" width="235" height="188" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;There are few other JS that&amp;#160; is responsible for generating the pager control which is not covered in this post, for this and more you can take a look at the latest bits of FlickrXplorer under &lt;a href="http://www.codeplex.com/flickrXplorer" target="_blank"&gt;www.codeplex.com/flickrXplorer&lt;/a&gt; .That’s so far and if you have some cool ideas to share on this,&amp;#160; let me know.&lt;/p&gt;

&lt;p&gt;Hope that helps.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://dotnetshoutout.com/Using-of-JSON-Result-in-Aspnet-MVC-10-Mehfuzs-WebLog" rev="vote-for"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fweblogs.asp.net%2Fmehfuzh%2Farchive%2F2009%2F04%2F28%2Fusing-of-json-result-in-asp-net-mvc-1-0.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7063244" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=6oXALYrHsPI:OIEbeeQxdr0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=6oXALYrHsPI:OIEbeeQxdr0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=6oXALYrHsPI:OIEbeeQxdr0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=6oXALYrHsPI:OIEbeeQxdr0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?i=6oXALYrHsPI:OIEbeeQxdr0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/6oXALYrHsPI" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/AspNetMvc/default.aspx">AspNetMvc</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/jQuery/default.aspx">jQuery</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/04/28/using-of-json-result-in-asp-net-mvc-1-0.aspx</feedburner:origLink></item><item><title>Programmatically generating SQL(DDL) from M</title><link>http://feedproxy.google.com/~r/burncsharp/~3/L9xllO5FMM4/programmatically-generating-sql-ddl-from-m.aspx</link><pubDate>Mon, 30 Mar 2009 10:03:05 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7010618</guid><dc:creator>mehfuzh</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=7010618</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=7010618</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/03/30/programmatically-generating-sql-ddl-from-m.aspx#comments</comments><description>&lt;p&gt;In this post, i will show how you can generate SQL programmatically from M. Now, so far i have learnt that MGrammer is a contract that converts user’s input into MGraph. Now, Oslo by default comes with MSchema. Through MSchema you can define a type and extend it with MGraph to populate your repository. Here, i will use MSchema to define an entity object , then MGraph and finally run this through a custom SQL generator in C# to get my DDL statement similar to what you can generate by using intellipad that comes with Oslo SDK.&lt;/p&gt;  &lt;p&gt;Let’s define a Contacts M&lt;/p&gt;  &lt;pre class="csharpcode"&gt;module Contacts {
    type Person {
        Id : Integer32;
        Name: Text;
        Age: Integer32;
    } &lt;span class="kwrd"&gt;where&lt;/span&gt; identity Id;
    
    People : Person*
    {    
        {Id = 1, Name=&lt;span class="str"&gt;&amp;quot;Steve&amp;quot;&lt;/span&gt;,Age=36}, 
        {Id = 2, Name=&lt;span class="str"&gt;&amp;quot;Kazi&amp;quot;&lt;/span&gt;,Age=30}
    };
    Employee : Person*
    {    
        {Id = 1, Name=&lt;span class="str"&gt;&amp;quot;Nike&amp;quot;&lt;/span&gt;,Age=29} 
    };
}&lt;/pre&gt;

&lt;p&gt;So, “Person” is a type with ID,Name and Age respectively that is under “Contacts” module with two different MGraph which are “People” and “Employee” that will generate separate &lt;em&gt;create table&lt;/em&gt; statements of “Person” type.&lt;/p&gt;

&lt;p&gt;Internally , M is&amp;#160; represented somewhat like&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/image_3252AFCD.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/image_thumb_7D65AA8F.png" width="238" height="170" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Parsing the M all starts with &lt;em&gt;Microsoft.M.Parser.SourceParser. &lt;/em&gt;In my sample M to SQL project, i used it like&lt;/p&gt;

&lt;pre class="csharpcode"&gt;SqlGenerator generator = SqlGenerator.Load(&lt;span class="kwrd"&gt;new&lt;/span&gt; StringReader(code));
&lt;span class="kwrd"&gt;string&lt;/span&gt; sql = generator.Generate();&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;
&lt;style type="text/css"&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Inside Load…&lt;/p&gt;

&lt;pre class="csharpcode"&gt;SourceParser parser = &lt;span class="kwrd"&gt;new&lt;/span&gt; SourceParser();
syntaxTerm = (CompilationUnit)parser.ParseTerm(reader, &lt;span class="str"&gt;&amp;quot;buffer.m&amp;quot;&lt;/span&gt;);
...
...

&lt;span class="rem"&gt;/// check if the parse was successful&lt;/span&gt;
&lt;span class="kwrd"&gt;if&lt;/span&gt; (!parser.LastParseSuccessful)
{
    &lt;span class="rem"&gt;/// do some error processing for invalid schema.&lt;/span&gt;
}&lt;/pre&gt;

&lt;p&gt;Now, once we have a valid grammar, our next step is to get the modules from ISytaxTerm implementation, for each module we have to process the MGraph for the specified type.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (IModuleDeclaration declaration &lt;span class="kwrd"&gt;in&lt;/span&gt; syntaxTerm.Modules)
{
    builder.AppendSetExtactAbort();
    builder.AppendGo();

    builder.AppendBeginTransaction();
    builder.AppendGo();

    builder.AppendSetANSINulls();
    builder.AppendGo();

    builder.AppendCreateSchema(declaration.Name.Value);
    builder.AppendGo();
    &lt;strong&gt;builder.Append(ProcessMembers(declaration.Name.Value, declaration.Members));
&lt;/strong&gt;
    builder.AppendCommitTransaction();
    builder.AppendGo();
}&lt;/pre&gt;

&lt;p&gt;This shows the basic skeleton of how the output will look like. &lt;em&gt;ProcessMembers&lt;/em&gt; is the actual place that generates the entity from type and associates Insert statements. Only, during the MGraph initialization type is realized. Therefore, the table name is equal to the extent name not to the type name.&lt;/p&gt;

&lt;p&gt;Inside ProcessMembers …&lt;/p&gt;
&lt;style type="text/css"&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;/// There will be three declaration &lt;/span&gt;
&lt;span class="rem"&gt;/// -TypeDeclaion&lt;/span&gt;
&lt;span class="rem"&gt;///- ExtentDeclaration&lt;/span&gt;
&lt;span class="rem"&gt;///- ExtnetDeclaration&lt;/span&gt;
&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (IDeclaration declaration &lt;span class="kwrd"&gt;in&lt;/span&gt; declarations)
{
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (declaration &lt;span class="kwrd"&gt;is&lt;/span&gt; TypeDeclaration)
    {
        typeDeclaration = (TypeDeclaration) declaration;
    }
 
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (declaration &lt;span class="kwrd"&gt;is&lt;/span&gt; ExtentDeclaration)
    {
       &lt;span class="rem"&gt;/// use the type declaration from previous step.&lt;/span&gt;
        builder.Append(ProcessExtent(name, typeDeclaration, (ExtentDeclaration) declaration));
    }
}&lt;/pre&gt;

&lt;p&gt;TypeDeclaration is narrowed down to &lt;em&gt;ParameteriedExpression&lt;/em&gt; , which has different operations for the declaring type&lt;em&gt;, &lt;/em&gt;which is tracked by&amp;#160; DeclartionReference.Name (“$Operator$Where”, “$Operator$Identity” , etc). Therefore, to process constraint and data types separately, we need to switch them for operation type.&amp;#160; Now, the question is how the MGraph is referred from the type specified. The JSON like string&amp;#160; is basically translated to GraphExpression. Like for the “Person” type , we have three properties. GraphExpression.Successors.Count will be equal to numeric value 3 and each of those which are GraphExpression themselves will have only one successor which is a M.Literal. This will actually contain the property name, type and value for parent type ref.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;GraphExpression graphExpression = (GraphExpression) extentDeclaration.InitialValue;

&lt;span class="kwrd"&gt;if&lt;/span&gt; (extentDeclaration.InitialValue != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
{
&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (GraphExpression successor &lt;span class="kwrd"&gt;in&lt;/span&gt; graphExpression.Successors)
{
    &lt;span class="kwrd"&gt;int&lt;/span&gt; index = 0;

    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var expression &lt;span class="kwrd"&gt;in&lt;/span&gt; successor.Successors)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (expression &lt;span class="kwrd"&gt;is&lt;/span&gt; GraphExpression)
        {
            GraphExpression node = (GraphExpression) expression;

            Literal literal = (Literal) (node).Successors[0];
           &lt;span class="rem"&gt;/// process fragment&lt;/span&gt;
        }

        index++;
    }
   &lt;span class="rem"&gt;/// process the final statement&lt;/span&gt;
}&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;That’s all to get started. All the code has been taken from a MSqlProvider that i created while learning M. The technology is itself in bleeding edge so things will change and i will share my updated knowledge forward. You can further enhance MSQLProvider to run the result in configured database along with the mx.exe that comes with Oslo SDK. &lt;/p&gt;

&lt;p&gt;You can download the source &lt;a href="http://weblogs.asp.net/blogs/mehfuzh/MSQLProvider_3EB0AD29.zip" target="_self"&gt;here&lt;/a&gt; to play around and see it live.&lt;/p&gt;

&lt;p&gt;Enjoy!!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f03%2f30%2fprogrammatically-generating-sql-ddl-from-m.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f03%2f30%2fprogrammatically-generating-sql-ddl-from-m.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7010618" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=L9xllO5FMM4:4ykgTl5Qb3s:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=L9xllO5FMM4:4ykgTl5Qb3s:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=L9xllO5FMM4:4ykgTl5Qb3s:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/burncsharp?a=L9xllO5FMM4:4ykgTl5Qb3s:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/burncsharp?i=L9xllO5FMM4:4ykgTl5Qb3s:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/L9xllO5FMM4" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Oslo/default.aspx">Oslo</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/MGrammer/default.aspx">MGrammer</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/03/30/programmatically-generating-sql-ddl-from-m.aspx</feedburner:origLink></item><item><title>Create custom LINQ providers fluently</title><link>http://feedproxy.google.com/~r/burncsharp/~3/ld1Fee61OqU/create-custom-linq-providers-fluently.aspx</link><pubDate>Wed, 25 Feb 2009 15:48:30 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6926008</guid><dc:creator>mehfuzh</dc:creator><slash:comments>5</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6926008</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6926008</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/02/25/create-custom-linq-providers-fluently.aspx#comments</comments><description>&lt;p&gt;Just released LinqExtender 2.0. Over previous release , it contains generally bugs fixes. Overall, I have focused on striping out complexity as much as possible to keep you focused on your business logic. You can see the full list of features in the documentation that comes with it.&lt;/p&gt;  &lt;p&gt;Now, while creating the LinqToTwitter example, I have shown that creating custom providers with LinqExtender requires two steps, first you have to define a query object by implementing IQueryObject and then you have made a Query&amp;lt;T&amp;gt; successor and override few methods. In LinqExtender, object/ entity equivalent is Bucket. Starting from 2.0, there is a Fluent interface implementation of it that works as an internal DSL and gives you a single entry point for all query and update , inserts and delete, thus making things more declarative and one way. &lt;/p&gt;  &lt;p&gt;In this post, I will show you how to generate SQL statement from LINQ query with nested &lt;em&gt;where &lt;/em&gt;clause,&lt;em&gt;&amp;#160;&lt;/em&gt;using the fluent interface implementation. To start, let's consider the following query&lt;/p&gt;  &lt;pre class="csharpcode"&gt;var query = from book &lt;span class="kwrd"&gt;in&lt;/span&gt; bookContext
&lt;span class="kwrd"&gt;where&lt;/span&gt; ((book.Author == &lt;span class="str"&gt;&amp;quot;Mehfuz&amp;quot;&lt;/span&gt; &amp;amp;&amp;amp; book.ISBN == &lt;span class="str"&gt;&amp;quot;2&amp;quot;&lt;/span&gt;) || book.Id == books[2].Id) || 
(book.Author == &lt;span class="str"&gt;&amp;quot;Paolo Pialorsi&amp;quot;&lt;/span&gt; &amp;amp;&amp;amp; (book.ISBN == &lt;span class="str"&gt;&amp;quot;100-11-777&amp;quot;&lt;/span&gt; || book.ISBN == &lt;span class="str"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;))
select book;&lt;/pre&gt;

&lt;p&gt;It's taken from the Entrypoint.cs test class that comes with LinqExtender project along with OpenLinqToSql sample ORM. Now, to do things in a very basic way. Let's first create a string builder and append the initial select.&lt;/p&gt;

&lt;p&gt;StringBuilder builder = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder(&lt;span class="str"&gt;&amp;quot;SELECT * FROM [&amp;quot;&lt;/span&gt; + Bucket.Instance.Entity.Name + &lt;span class="str"&gt;&amp;quot;]&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;To be precise, Bucket.Instance is the entry point for all query and object details. Moving to &lt;em&gt;where statement , &lt;/em&gt;LinqExtender uses simplified expression tree that is exposed by &lt;em&gt;Bucket.Instance.ExpressionTree. A&lt;/em&gt;ll we need to setup how the output will look like and the rest will be covered by the toolkit.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;builder.Append(&lt;span class="str"&gt;&amp;quot;WHERE&amp;quot;&lt;/span&gt;);
builder.Append(&lt;span class="str"&gt;&amp;quot;\r\n&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;Bucket
.Instance
.ExpressionTree
.DescribeContainerAs(builder)
.Root((containter, operatorType) =&amp;gt; containter.Append(&lt;span class="str"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + operatorType + &lt;span class="str"&gt;&amp;quot; &amp;quot;&lt;/span&gt;))
.Begin(container =&amp;gt; container.Append(&lt;span class="str"&gt;&amp;quot;(&amp;quot;&lt;/span&gt;))
.EachLeaf((container, item) =&amp;gt;
 {
     &lt;span class="kwrd"&gt;string&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt; = GetValue(item.Value);
     container.Append(item.Name + RelationalOperators[item.RelationType] + &lt;span class="kwrd"&gt;value&lt;/span&gt;);
 })
.End(container =&amp;gt; container.Append(&lt;span class="str"&gt;&amp;quot;)&amp;quot;&lt;/span&gt;))
.Execute();&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Here, let assume that GetValue(..) will return a formatted SQL string and ReleationalOperators is a dictionary that has mappings for item.RealtionType ( GreaterThan -&amp;gt; &amp;quot;&amp;gt;&amp;quot; , LessThan =&amp;gt; &amp;quot;&amp;lt;&amp;quot;, etc). Basically, as the implementation shows, we are defining the way output will be stored in the container (In this case, StringBuilder). All these code should be placed in Query&amp;lt;T&amp;gt;.Process(IModify&amp;lt;T&amp;gt; items) method and on execute it will just return the following SQL block&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Select * from book 
 WHERE
(((Author=&lt;span class="str"&gt;'Mehfuz'&lt;/span&gt; AND ISBN=&lt;span class="str"&gt;'2'&lt;/span&gt;) OR Bk_Id=&lt;span class="str"&gt;'1734'&lt;/span&gt;) 
OR (Author=&lt;span class="str"&gt;'Paolo Pialorsi'&lt;/span&gt; AND (ISBN=&lt;span class="str"&gt;'100-11-777'&lt;/span&gt; OR ISBN=&lt;span class="str"&gt;'1'&lt;/span&gt;))) &lt;/pre&gt;

&lt;p&gt;Extender basically knows how to get though this nested where clause. From basic computer science, it builds linked objects based on a Syntax Tree, with each parenthesis adding diversion to the tree like shown below&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/CreateyourcustomLINQprovidersfluently_FB49/image_2.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/CreateyourcustomLINQprovidersfluently_FB49/image_thumb.png" width="266" height="170" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So far, this is a very rudimentary example. With 2.0 it is also possible to build your own reusable format provider for building literals that saves repetitive code blocks for same kind of task (updating a database). This is actually just a schema builder that defines how the output will look like using the same Bucket.Instance calls. Out of the box, TSqlFormatProvider is provided.Depending under which Query&amp;lt;T&amp;gt; method it is used; it will generate insert, update, delete or select statement where all you have to call &lt;em&gt;Bucket.Instance.Translate(...)&lt;/em&gt;.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; sql = Bucket.Instance.Translate(&lt;span class="kwrd"&gt;new&lt;/span&gt; TSqlFormatProvider());&lt;/pre&gt;

&lt;p&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;This enables you to build not only your own LINQ to Anything format providers but also share it with the community to reuse what is already out there. More information on how to get started can be found at the project documentation.&lt;/p&gt;

&lt;p&gt;In a word, Bucket.Instance is all you need to go through and build your own LINQ provider. Optionally, you can override the following methods (under Query&amp;lt;T&amp;gt;) to give your provider various OTS (Object tracking service) support .&lt;/p&gt;

&lt;p&gt;1. AddItem () - called during SubmitChanges() call for new object. 
  &lt;br /&gt;2. RemoveItem () - called during SubmitChanges() call for Delete. 

  &lt;br /&gt;3. UpdateItem () &amp;#8211; called during SubmitChanges() call for update. 

  &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;I have updated &lt;a href="http://weblogs.asp.net/mehfuzh/archive/2009/01/01/creating-linqtotwitter-library-using-linqextender.aspx" target="_blank"&gt;Creating LinqToTwitter using LinqExtender&lt;/a&gt; post with the latest release. You can get a copy of the latest 2.0 release from &lt;a href="http://www.codeplex.com/linqextender"&gt;www.codeplex.com/linqextender&lt;/a&gt;,&amp;#160; and of course as usual all your feedbacks are really helping to shape the toolkit.&lt;/p&gt;

&lt;p&gt;Hope that helps,&lt;/p&gt;

&lt;p&gt;&lt;font color="#ff0000"&gt;Update on 28th Feb 2009, with new patch for Bucket.Instance.ExpressionTree&lt;/font&gt;&lt;/p&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f02%2f25%2fcreate-custom-linq-providers-fluently.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f02%2f25%2fcreate-custom-linq-providers-fluently.aspx" /&gt;&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6926008" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=8UaUjm1o"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=1P8aMPdF"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=gWGnVMk9"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=XGcfxZqW"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=XGcfxZqW" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/ld1Fee61OqU" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LinqExtender/default.aspx">LinqExtender</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/02/25/create-custom-linq-providers-fluently.aspx</feedburner:origLink></item><item><title>Adding streaming video content to your site</title><link>http://feedproxy.google.com/~r/burncsharp/~3/GhB5Oo4qQe4/adding-streaming-video-content-to-your-site.aspx</link><pubDate>Thu, 29 Jan 2009 15:49:29 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6868377</guid><dc:creator>mehfuzh</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6868377</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6868377</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/01/29/adding-streaming-video-content-to-your-site.aspx#comments</comments><description>&lt;p&gt;In my last post, I showed how to turn on Amazon S3 support in Sitefinity. In this post, I will show how to create a simple video site using the video library support that is bundled with 3.6 release. It is often required that you want to add a streaming video content to your site, either it could be a product demonstration or a getting started tutorial. Using third party video provider is one way to get the job done but sometimes it requires a lot of manual work, thus headache for managing them as the library grows bigger. 3.6 release breaks you free from all these and provides an easy way for creating , uploading and managing video content.&lt;/p&gt;  &lt;p&gt;Now, uploading video content and publishing them requires a few easy steps. You can either decide to store / stream it from your hosting server or from Amazon S3, typically which can be divided into following.&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Configure the data provider &lt;/li&gt;      &lt;li&gt;Create a video library &lt;/li&gt;      &lt;li&gt;Upload videos &lt;/li&gt;      &lt;li&gt;Create a page and add the video content control onto it. &lt;/li&gt;      &lt;li&gt;Publish it. &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;Sitefinity uses RadMediaPlayer (comes as part of Telerik Rad controls suit), a cool Silverlight media player made on top of the basic MediaPlayer with out of the box features that can get you on the groove right away. As I mentioned already, Sitefinity is a combination of content, modules and pages. Modules can have their own data providers, own handlers, whereas each page can control its content presentation by using the revolutionary control designer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="207" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/image_thumb.png" width="313" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Coming back, to start creating our simple video site first we need to create a module (which is a video library). We can either choose to use the default data provider &amp;quot;Libraries&amp;quot; or we can define our own custom provider. To define one by ourselves we must ensure the following&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Create an entry under &amp;lt;cmsEngine&amp;gt; that looks like &amp;quot;&amp;lt;add name=Libraries...&amp;quot;&amp;#160; or like the one described in Amazon S3 post. &lt;/li&gt;    &lt;li&gt;Add related meta fields under &amp;lt;metaFields&amp;gt; that are same as the default ones with only prefix = &lt;em&gt;name, &lt;/em&gt;you have given to the data provider       &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;key&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Libraries.Description&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;valueType&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ShortText&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;visible&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;searchable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;sortable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;defaultValue&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;p&gt;&lt;span class="kwrd"&gt;This converters to the following where name = &amp;quot;MyLib&amp;quot;. Similar goes for the rest.&lt;/span&gt;&lt;/p&gt;

    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;key&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MyLib.Description&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;valueType&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ShortText&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;visible&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;searchable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;sortable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;defaultValue&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;&lt;span class="kwrd"&gt;Map it with &amp;quot;Libraries&amp;quot; module under &lt;em&gt;libraries.genericContentproviders&lt;/em&gt;&lt;/span&gt; 

    &lt;pre class="csharpcode"&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;libraries&lt;/span&gt; &lt;span class="attr"&gt;defaultGenericProvider&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Libraries&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;genericContentProviders&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;providerName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MyLib&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;publicationDateField&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Publication_Date&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  .........
  .........&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;Under &lt;em&gt;cmsEngine.providers.add &lt;/em&gt;(where name=&amp;quot;MyLib/Libraries&amp;quot;) there is a key called &lt;em&gt;applicatinName, &lt;/em&gt;which is set to &amp;quot;/Libraries&amp;quot; but we can set it to &amp;quot;/MyOwnApplciation&amp;quot; to ensure that it does not mess data up with the default one. &lt;/li&gt;
&lt;/ul&gt;
&lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;For multiple data providers you will see a &lt;em&gt;dropdown&lt;/em&gt; in the library create wizard, to upload under the specific one, we just need to select and start uploading.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/MultipleLIbrary.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="296" alt="MultipleLIbrary" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/MultipleLIbrary_thumb.jpg" width="415" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So, once we have created a video library it will automatically take us to the upload view and once it is done, we can see the preview right away. Next,&amp;#160; we just need to drag and drop the video control onto the page. To further customize it, we can play around with designer that is tied with it (click on the &amp;quot;edit&amp;quot; link) we can set things like the max width for the thumbnail or video player and tweak labels and meta datas as we go.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/VideoEdit_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="270" alt="VideoEdit" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/VideoEdit_thumb_2.jpg" width="427" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;We have already seen how to set up multiple data providers and select specific libraries from designer. Moreover, we can set custom provider from advance mode of the content control. This applies to all Sitefinity content controls like Events, Blogs, etc that implements the same generic content base class.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/advanced_1.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="52" alt="advanced" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/advanced_thumb_1.jpg" width="432" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Finally, if all are set, we will see a video page like the one shown just below. While we are uploading video, each will have a thumbnail generated from the video itself that will be shown in the list view. Each items in list view is tied with a detail view (similar to video sites), where you can play the video, leave comments and bookmark it in your favorite social networking site.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/Video_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="338" alt="Video" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Addingstreamingvideocontentinyoursite_EE56/Video_thumb_2.jpg" width="422" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;We have already seen in my previous post that we can set the urlRewriteFormat in the data provider declaration. For local libraries , when urlRewriteFormat=&amp;quot;~/{LibraryName}/[Name].sflb.ashx&amp;quot; the video detail permalink will be http://&amp;lt;hostname&amp;gt;/&amp;lt;applicationPath&amp;gt;/&amp;lt;pagename&amp;gt;/MyLib/ButterFly.aspx, that means the video content control (detail view) will have the same mirror URL terminating with &amp;quot;*.aspx&amp;quot;. So, if you change the URL format in library data provider it will reflect in the content control as well.&lt;/p&gt;

&lt;p&gt;So far, that's all for the simple video site. Let us know, how you like to shape it for you and what features you really want to add in it. You can grab a free &lt;a href="http://www.sitefinity.com/product/community-edition.aspx" target="_blank"&gt;community edition&lt;/a&gt;&amp;#160; and of course any feedback will really make us feel better.&lt;/p&gt;

&lt;p&gt;Hope that helps&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f01%2f29%2fadding-streaming-video-content-to-your-site.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f01%2f29%2fadding-streaming-video-content-to-your-site.aspx" border="0" /&gt;&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6868377" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=vkr4R2D3"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=s10cR0EJ"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=BUNEo9pB"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=tCZMT6g9"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=tCZMT6g9" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/GhB5Oo4qQe4" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Sitefiinity/default.aspx">Sitefiinity</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/01/29/adding-streaming-video-content-to-your-site.aspx</feedburner:origLink></item><item><title>Amazon S3 support in Sitefinity 3.6</title><link>http://feedproxy.google.com/~r/burncsharp/~3/-w3wxv4mT-0/amazon-s3-support-in-sitefinity-3-6.aspx</link><pubDate>Fri, 23 Jan 2009 08:27:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6858172</guid><dc:creator>mehfuzh</dc:creator><slash:comments>18</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6858172</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6858172</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/01/23/amazon-s3-support-in-sitefinity-3-6.aspx#comments</comments><description>&lt;P&gt;Here at Telerik, Sitefinity team is preparing for the 3.6 release next week. 3.6 comes with lot of core level enhancements and cool new features. Of which , I can't but mention one feature that will make most ISV vendors who want the power of CMS but want to let go their pain of managing large content. As, the title suggests its external storage support via Amazon S3. The data plan for hosting and transferring data to/from S3 server is pretty cheap these days in return to world class service with almost zero downtime that it offers which of course makes the most of your money. If you are not familiar with Sitefinity to add it is a product by &lt;A href="http://www.telerik.com/" target=_blank mce_href="http://www.telerik.com"&gt;Telerik&lt;/A&gt;&amp;nbsp; that comes with full content management features along with blogs, news, events, list and few other pre-made modules with easy setup and management via unique control designer.&lt;/P&gt;
&lt;P&gt;In this post, I will show how to turn on S3 support in Sitefinity 3.6 that comes out of the box.In Sitefinity, files are kept in Library. Every file which can be audio, video, document or anything else is stored as Library entries, which are consumed by modules for example images in blog post. These library entries are dependant on data providers which can be extended from internal to cloud. S3 support is just a plugin to that extensibility.&lt;/P&gt;
&lt;P&gt;Now, to configure S3 support let's start with a simple example. I want to create a personal blog and I want all the images and attachments go to Amazon S3 server. To do so , we need to ensure the following&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Turn on the S3 data provider in web.config (that comes with the installation) &lt;/LI&gt;
&lt;LI&gt;Add your S3 API and secret key to the specific place holder. &lt;/LI&gt;
&lt;LI&gt;Create your blog module &lt;/LI&gt;
&lt;LI&gt;Drag and drop your module over a page. &lt;/LI&gt;
&lt;LI&gt;Publish it &lt;/LI&gt;
&lt;LI&gt;Use Admin or Live writer to do your post with Images and attachments. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Steps 3- 6 are pretty basic and are beyond the scope of this post. I will deeply encourage you to grab a community version from the project's download page(link provided at the end) and see the step by step documentation that comes right with it.&lt;/P&gt;
&lt;P&gt;To start setting up, first we need to navigate to the &lt;EM&gt;&lt;STRONG&gt;cmsEngine&lt;/STRONG&gt;&lt;/EM&gt; node. If amazon block is there then un-comment it and remove the default "Libraries" data provider or less add the following data provider.&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;add&lt;/SPAN&gt; &lt;SPAN class=attr&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Libraries"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;urlRewriteFormat&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="~/{LibraryName}/[Name].s3lb"&lt;/SPAN&gt; 
    &lt;SPAN class=attr&gt;thumbnailExtension&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;=".tmb"&lt;/SPAN&gt;
    &lt;SPAN class=attr&gt;urlDateTimeFormat&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="yy-MM-dd"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;urlWhitespaceChar&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="_"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;visible&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="False"&lt;/SPAN&gt; 
&lt;SPAN class=attr&gt;    defaultMetaField&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Name"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;applicationName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="/Libraries"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;allowVersioning&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="True"&lt;/SPAN&gt; 
&lt;SPAN class=attr&gt;    allowLocalization&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="False"&lt;/SPAN&gt;
&lt;SPAN class=attr&gt;    localizationProviderName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;=""&lt;/SPAN&gt; &lt;SPAN class=attr&gt;allowWorkflow&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="False"&lt;/SPAN&gt; 
&lt;SPAN class=attr&gt;    securityProviderName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;=""&lt;/SPAN&gt; &lt;SPAN class=attr&gt;versioningProviderName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;=""&lt;/SPAN&gt;
    &lt;SPAN class=attr&gt;connectionStringName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="GenericContentConnection"&lt;/SPAN&gt; 
&lt;SPAN class=attr&gt;    type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Telerik.Libraries.Data.AmazonProvider, Telerik.Libraries.Data"&lt;/SPAN&gt;
&lt;SPAN class=attr&gt;    tagEditorTemplate&lt;/SPAN&gt;=&lt;SPAN class=kwrd&gt;"~/Sitefinity/Admin/ControlTemplates/Libraries/BatchTagsEditor.ascx"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Now, inside the data provider you can do plenty of tweaks like, modify the URL format , turn on/off localization, have multiple providers of same type (with different &lt;EM&gt;name&lt;/EM&gt;) and map it from admin, etc. The most important thing for libraries or any other module is the urlRewriteFormat. You can set up any format and the detail (permalink) url will generate accordingly. Here, [Name] = name of the file but you can change it to any meta fields that the module supports or add any constants you want.&lt;/P&gt;
&lt;P&gt;The amazon data provider is different in two ways from local one &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;It has different content extension(.s3lb). &lt;/LI&gt;
&lt;LI&gt;Separate data provider dedicated to communicate with S3. Default type = Telerik.Libraries.Data.DefaultProvider &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;As, we are pretty much done with the first step. Next, we have to put the right API and secret access key that we have purchased from Amazon. All the transfers will be made against the key associated to a user's account. Under the &lt;EM&gt;&lt;STRONG&gt;telerik&lt;/STRONG&gt;&lt;/EM&gt; node we have a section called &lt;EM&gt;&lt;STRONG&gt;storageSetting&lt;/STRONG&gt;&lt;/EM&gt; which looks like&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;storageSetting&lt;/SPAN&gt; &lt;SPAN class=attr&gt;defaultProvider&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Amazon"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;providers&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;add&lt;/SPAN&gt; &lt;SPAN class=attr&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Amazon"&lt;/SPAN&gt;           
          &lt;SPAN class=attr&gt;type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Telerik.Libraries.AmazonStorage.AmazonStorageProvider, Telerik.Libraries"&lt;/SPAN&gt; 
          &lt;SPAN class=attr&gt;downloadUrlPrefix&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://s3.amazonaws.com"&lt;/SPAN&gt; 
          &lt;SPAN class=attr&gt;accessKey&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="YOUR ACCESS KEY"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;secretAccessKey&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="YOUR SECRECT KEY"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;bucketName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Sitefinity"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;providers&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;storageSetting&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Just Fill in the gaps and you are through. In Sitefinity module is the heart of every content and a page can contain 1..N modules but each module can have its own specific settings like data provider, URL format, etc. As we have finished setting up the data provider and associated configuration to talk with S3 server. we can now play the way we like. We can create gallery with image library or setup&amp;nbsp; a download list for providing documents and pdfs. Even we can setup a video site(which I will cover in later post) easily. But for now , let's create a blog, write a post, add some images and text and publish it.&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://weblogs.asp.net/blogs/mehfuzh/myGif.gif" mce_href="http://weblogs.asp.net/blogs/mehfuzh/myGif.gif"&gt;&lt;/A&gt;&lt;IMG title="SiteFinity Admin page edit" style="WIDTH: 500px; HEIGHT: 283px" height=283 alt="SiteFinity Admin page edit" src="http://weblogs.asp.net/blogs/mehfuzh/myGif.gif" width=500 mce_src="http://weblogs.asp.net/blogs/mehfuzh/myGif.gif"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above is the snap of edit mode of the blog page along with the post that I have done using Live Writer. Now, to be more sure (we haven't done any wrong) if you monitor using firebug Net tab your list will look like the pasted&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://weblogs.asp.net/blogs/mehfuzh/FirebugAmazonSite.JPG" mce_href="http://weblogs.asp.net/blogs/mehfuzh/FirebugAmazonSite.JPG"&gt;&lt;/A&gt;&lt;IMG title="Fiirbug stat" style="WIDTH: 555px; HEIGHT: 180px" height=180 alt="Fiirbug stat" src="http://weblogs.asp.net/blogs/mehfuzh/FirebugAmazonSite.JPG" width=555 mce_src="http://weblogs.asp.net/blogs/mehfuzh/FirebugAmazonSite.JPG"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Down in the bottom there are two request for images posted by Live Writer which are directly forwarded to S3 server (302-&amp;gt;200). Thus, the whole load goes to Amazon and gives you peaceful night sleep.&lt;/P&gt;
&lt;P&gt;This is basically shortly all for now, I will cover more things from Sitefinity like creating video site , working with Sitefinity designers to configure your site without touching any of the html code and more that is interesting in my future posts.&lt;/P&gt;
&lt;P&gt;Till then, you can get a free copy from &lt;A class="" title=http://www.sitefinity.com/product/community-edition.aspx href="http://www.sitefinity.com/product/community-edition.aspx" target=_blank mce_href="http://www.sitefinity.com/product/community-edition.aspx"&gt;http://www.sitefinity.com/product/community-edition.aspx&lt;/A&gt; (you need to create an account if you haven't. You can use it for other Telerik products and to log any issues as well.&lt;/P&gt;
&lt;P&gt;Hope that helps&lt;/P&gt;&lt;A href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f01%2f23%2famazon-s3-support-in-sitefinity-3-6.aspx"&gt;&lt;IMG alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f01%2f23%2famazon-s3-support-in-sitefinity-3-6.aspx" border=0&gt;&lt;/A&gt; &lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6858172" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=ULa6fAsa"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=r0rMM80h"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=OCjTmack"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=MRziXCus"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=MRziXCus" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/-w3wxv4mT-0" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Sitefiinity/default.aspx">Sitefiinity</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/01/23/amazon-s3-support-in-sitefinity-3-6.aspx</feedburner:origLink></item><item><title>Creating LINQToTwitter library using LinqExtender</title><link>http://feedproxy.google.com/~r/burncsharp/~3/u-3xEMnXt34/creating-linqtotwitter-library-using-linqextender.aspx</link><pubDate>Thu, 01 Jan 2009 17:53:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6811649</guid><dc:creator>mehfuzh</dc:creator><slash:comments>15</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6811649</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6811649</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2009/01/01/creating-linqtotwitter-library-using-linqextender.aspx#comments</comments><description>&lt;p&gt;In this post, I will show how to cook an LINQToTwitter library with LinqExtender. My target is to create it easily and over existing twitter API. I used &lt;a href="http://devblog.yedda.com" target="_blank"&gt;Yedda&lt;/a&gt; Twitter library. Yedda library basically returns response in XML/JSON/RSS/ATOM format depending on the option provided. I used XML format and serialized it to objects. &lt;/p&gt;  &lt;p&gt;Now, with our LINQToTwitter we will be able to get public/user/friend's timeline, sort them via date, screen name. Finally, we will be able to update our status. Twitter response format for status looks like&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;statuses&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;status&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
          ....
          ....
         &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;user&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
             ....
             ....
         &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;user&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;status&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;statuses&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;span class="kwrd"&gt;For this, I have created a class named &lt;/span&gt;&lt;span class="kwrd"&gt;&lt;u&gt;Twit&lt;/u&gt; that maps to the status and a class name &lt;u&gt;User&lt;/u&gt; that is used as an auto property in &lt;u&gt;Twit&lt;/u&gt;. These two classes contain some Xml Serialization attributes&amp;#160; by which response is serialized to respective properties.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="kwrd"&gt;We have our Twitter API in place, the next step is to make them LINQ-able. Prior to the latest release to make an object queryable, it is required to inherit from QueryObjectBase. Using this approach the feed back I got from users that they need to try LINQ in their existing data objects, which is already inherited from a base class and they need to change a lot for using the abstract approach. The new release just solves that with a blank IQueryObject interface, which makes it more easier to port LINQ into existing data object in no time.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="kwrd"&gt;Building LINQ providers with LinqExtender requires few easy steps. &lt;/span&gt;&lt;span class="kwrd"&gt;First, Create or convert an object to be queryable by implementing IQueryObject interface. With our Twit object it looks like&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/CreatingaLINQToTwitterusingLinqExtender_130AE/image_10.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/CreatingaLINQToTwitterusingLinqExtender_130AE/image_thumb_4.png" width="464" height="169" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Here, note that I added &lt;em&gt;UniqueIdentifier&lt;/em&gt; attribute on top of &lt;em&gt;Id&lt;/em&gt; property that makes the object trackable during add, update or delete. Every object should have property that distinguishes entities from each other and should be marked Unique. There is another attribute called &lt;em&gt;Ignore&lt;/em&gt;. If we want properties not to be processed by the toolkit we can just put the attribute on top. Once, it is done next we have to create query provider that will be used for making LINQ queries. Let's name it &lt;u&gt;TwitterContext&lt;/u&gt; and it needs to inherit Query&amp;lt;Twit&amp;gt; and override few methods depending on support that the library is going to provide.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/CreatingaLINQToTwitterusingLinqExtender_130AE/image_3.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/CreatingaLINQToTwitterusingLinqExtender_130AE/image_thumb.png" width="458" height="85" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now, as I said earlier that we will be doing some queries by timeline and update our status. While adding new items we need to override Query&amp;lt;Twit&amp;gt;.AddItem where we will add object to repository and update any property that we need to get and finally return true/ false depending on the execution status.&lt;/p&gt;

&lt;p&gt;Inside Query&amp;lt;Twit&amp;gt;.AddItem it looks like (Partially).&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; username = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)Bucket.Instance.For.Item(QueryItems.USERNAME).Value;
&lt;span class="kwrd"&gt;string&lt;/span&gt; password = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)Bucket.Instance.For.Item(QueryItems.PASSWORD).Value;

Validate(username, password);

&lt;span class="kwrd"&gt;string&lt;/span&gt; statusText = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)Bucket.Instance.For.Item(&lt;span class="str"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;).Value;
&lt;span class="kwrd"&gt;string&lt;/span&gt; source = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)Bucket.Instance.For.Item(&lt;span class="str"&gt;&amp;quot;Source&amp;quot;&lt;/span&gt;).Value;

Twitter twitter = &lt;span class="kwrd"&gt;new&lt;/span&gt; Twitter();

&lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(source))
{
    twitter.Source = source;
}

&lt;span class="kwrd"&gt;string&lt;/span&gt; response = twitter.Update(username, password, statusText, Twitter.OutputFormatType.XML);

Twit twit = XmlToObject&amp;lt;Twit&amp;gt;.Deserialize(response);
Type twitType = twit.GetType();

Bucket.Instance.For.EachItem
.Process(&lt;span class="kwrd"&gt;delegate&lt;/span&gt;(BucketItem item)
 {
     item.Value = twitType.GetProperty(item.Name).GetValue(twit, &lt;span class="kwrd"&gt;null&lt;/span&gt;);
 });&lt;/pre&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The code is pretty simple as we can see that we are getting the required values from bucket object , setting them into Twitter API, updating the result object (Twit) and finally returning TRUE that will tell LinqExtender to update it's collection. For any FALSE or exception toolkit will remove the partial object. There are other methods that we can override like UpdateItem, RemoveItem, GetItem. Due to the API constraint we will skip them now. But you can check them out at the project documentation or in the provided OpenLinqToSql ORM.&lt;/p&gt;

&lt;p&gt;Next, we need to override the Query&amp;lt;Twit&amp;gt;.Process which will be handling the LINQ queries we make. &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Process(LinqExtender.Interface.IModify&amp;lt;Twit&amp;gt; items)
{
    &lt;span class="kwrd"&gt;string&lt;/span&gt; response = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;

    Twitter twitter = &lt;span class="kwrd"&gt;new&lt;/span&gt; Twitter();

    &lt;span class="rem"&gt;/// general select statement with no where clause.&lt;/span&gt;
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!Bucket.Instance.IsDirty)
    {
        response = twitter.GetPublicTimeline(Twitter.OutputFormatType.XML);
    }
    &lt;span class="kwrd"&gt;else&lt;/span&gt;
    {
            &lt;span class="kwrd"&gt;string&lt;/span&gt; username = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)Bucket.Instance.For.Item(QueryItems.USERNAME).Value;
            &lt;span class="kwrd"&gt;string&lt;/span&gt; password = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)Bucket.Instance.For.Item(QueryItems.PASSWORD).Value;
            &lt;span class="kwrd"&gt;object&lt;/span&gt; obj = (Timeline)Bucket.Instance.For.Item(QueryItems.TIMELINE).Value;

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (obj == &lt;span class="kwrd"&gt;null&lt;/span&gt;)
            {
                &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception(&lt;span class="str"&gt;&amp;quot;Must provide a valid timeline&amp;quot;&lt;/span&gt;);
            }

            Timeline timeline = (Timeline) obj;

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (timeline == Timeline.Friends)
            {
                Validate(username, password);
                response = twitter.GetFriendsTimeline(username, password, Twitter.OutputFormatType.XML);
            }
            &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (timeline == Timeline.User)
            {
                response = twitter.GetUserTimeline(username, password, Twitter.OutputFormatType.XML);
            }
        }

        Twits twits = XmlToObject&amp;lt;Twits&amp;gt;.Deserialize(response);

        &lt;span class="rem"&gt;/// do some extra in-memory stuff which are not supported by API&lt;/span&gt;
        IList&amp;lt;Twit&amp;gt; list = GetList(twits);

        items.AddRange(list, &lt;span class="kwrd"&gt;true&lt;/span&gt;);
}&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Here, we can see that &lt;em&gt;Bucket.Instance.IsDirty&lt;/em&gt; is used for public timelines. When &lt;em&gt;Bucket.Instance.IsDirty = false&lt;/em&gt;, we can be sure that no where clause is used and as such we can decide to handle the way we want. IModify&amp;lt;T&amp;gt;.AddRange with true tells the toolkit to do in-memory sort when orderby is used. There is another way to do sort (natural sort) by which we can pass in the sort data to source (if supported) and in that case we can either pass false or use the other overload of AddRange or even add items one by one.&lt;/p&gt;

&lt;p&gt;This is our simple LINQToTwitter library so far. To start let's do some queries. First, I want to get my friend's timeline sorted by last updated date.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;TwitterContext context = new TwitterConext();&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;var query = from twit &lt;span class="kwrd"&gt;in&lt;/span&gt; context
             &lt;span class="kwrd"&gt;where&lt;/span&gt; twit.Username == &lt;span class="str"&gt;&amp;quot;myuser&amp;quot;&lt;/span&gt;
                       &amp;amp;&amp;amp; twit.Password == &lt;span class="str"&gt;&amp;quot;mypass&amp;quot;&lt;/span&gt;
                       &amp;amp;&amp;amp; twit.Timeline == Timeline.Friends
             orderby twit.LastUpdated descending
             select twit;

&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var t &lt;span class="kwrd"&gt;in&lt;/span&gt; query)
{
     /&lt;span class="rem"&gt;// do something useful.&lt;/span&gt;
}&lt;/pre&gt;

&lt;p&gt;I also want to update my status. To do so, the following needs to be done.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Twit twitObject = &lt;span class="kwrd"&gt;new&lt;/span&gt; Twit()
{
  Username = USERNAME,
  Password = PASSWORD,
  Text = &lt;span class="str"&gt;&amp;quot;Happy new year to all&amp;quot;&lt;/span&gt;
};
context.Add(twitObject);
context.SubmitChanges();

&lt;span class="kwrd"&gt;if&lt;/span&gt; (!&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(twitObject.Id))
{
    /&lt;span class="rem"&gt;// do something&lt;/span&gt;
}&lt;/pre&gt;

&lt;p&gt;There are few other queries that can be made. You can download the &lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/CreatingaLINQToTwitterusingLinqExtender_130AE/LinqToTwitter_1.zip" target="_self"&gt;source here&lt;/a&gt;. I have shown here very few of the options in LinqExtender, to know more check out the word document at &lt;a href="http://www.codeplex.com/LinqExtender/Release/ProjectReleases.aspx?ReleaseId=23620" target="_blank"&gt;project's release page&lt;/a&gt;. Also, check the OpenLinqToSql ORM that is made on it and comes out of the box. &lt;/p&gt;

&lt;p&gt;Enjoy!!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;Updated on Feb 24th 2009 with LinqExtender 2.0&lt;/font&gt;&lt;/strong&gt; &lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f01%2f01%2fcreating-linqtotwitter-library-using-linqextender.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2009%2f01%2f01%2fcreating-linqtotwitter-library-using-linqextender.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6811649" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=WquUs9TG"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=YhVyeOFY"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=HKOvWT05"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=rEtpXhn5"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=rEtpXhn5" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/u-3xEMnXt34" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LinqExtender/default.aspx">LinqExtender</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/LinqToTwitter/default.aspx">LinqToTwitter</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2009/01/01/creating-linqtotwitter-library-using-linqextender.aspx</feedburner:origLink></item><item><title>Making cross domain web requests in asp.net with medium trust enabled</title><link>http://feedproxy.google.com/~r/burncsharp/~3/OFUafy-Sslw/making-cross-domain-web-requests-in-asp-net-with-medium-trust-enabled.aspx</link><pubDate>Sun, 07 Dec 2008 17:45:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6769729</guid><dc:creator>mehfuzh</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6769729</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6769729</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2008/12/07/making-cross-domain-web-requests-in-asp-net-with-medium-trust-enabled.aspx#comments</comments><description>&lt;P&gt;There could be plenty of reason that you might need to do a cross domain web request in your application. One could be let's say you want to divert the resource pressure from your server to some third party content&amp;nbsp;provider like Amazon S3. In my last post I have mentioned a bit about uploading content using WSE to S3 server. I also mentioned about the simple library located at &lt;A href="http://www.codeplex.com/threesharp" target=_blank&gt;www.codeplex.com/threesharp&lt;/A&gt; that does not necessarily require you to work in full trust mode.&amp;nbsp;This is also true if&amp;nbsp;you have a personalized startpage where you want your wideget developers to restrict&amp;nbsp;to partiuclar URLs. &lt;/P&gt;
&lt;P&gt;Now, before starting it is worth mentioning that in medium trust mode any cross domain&amp;nbsp;request is disabled by default. In other words, you can do calls only for your local endpoints. &lt;/P&gt;
&lt;P&gt;How to get around this ?&lt;/P&gt;
&lt;P&gt;When you install .net framework under &lt;STRONG&gt;%installed dir%\framework\version\config&lt;/STRONG&gt; you will find a web_(high or medium or low)trust.config file that defines some policy about how your application will behave in a particular security level specified.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Makingcrossdom.netwithmediumtrustenabled_11F29/trustLevel_2.jpg" mce_href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Makingcrossdom.netwithmediumtrustenabled_11F29/trustLevel_2.jpg"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=146 alt=trustLevel src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Makingcrossdom.netwithmediumtrustenabled_11F29/trustLevel_thumb.jpg" width=334 border=0 mce_src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Makingcrossdom.netwithmediumtrustenabled_11F29/trustLevel_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Now, to customize the default medium trust settings best is to copy it to your application directory so that you can tweaks thing only for your application and don't end up making it unstable in global scope. To show it as an example I have created a sample project that tries to do a web request, gets the data out and finally stuffs it to the response stream. To simulate, first let's put the following line in web.config which is pretty general for those of you works with it daily to strictly support medium trust in your app.&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;trust&lt;/SPAN&gt; &lt;SPAN class=attr&gt;level&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Medium"&lt;/SPAN&gt;  &lt;SPAN class=kwrd&gt;/&amp;gt; // this is only for simulating in localhost&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Next is to define your security level and config that will look for policies&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;securityPolicy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;trustLevel&lt;/SPAN&gt; &lt;SPAN class=attr&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Medium"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;policyFile&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="web_mediumtrust.config"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;securityPolicy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;The above line&amp;nbsp;will come into action only&amp;nbsp;when medium trust is enabled. But here to&amp;nbsp;note that&amp;nbsp;if you dont have control over your hosting provider or your&amp;nbsp;hosting has a &lt;STRONG&gt;&amp;lt;location allowOverride="false"&amp;gt;&lt;/STRONG&gt; node in the root config then this approach&amp;nbsp;won't work. Either you have to tell your hosting provider to add the requested URL for you or if you are doing things&amp;nbsp;with your own hosting then you have to do it by yourself :-).&lt;/P&gt;
&lt;P&gt;If you generally try to do a web request without any predefined policy defined in medium trust then you might see the following error&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;To overcome, once you have medium trust config in place you need to override the connectAccess property of &lt;EM&gt;WebPermission&lt;/EM&gt; class. To do so , let's say I want to grant request for search.&lt;EM&gt;live.com &lt;/EM&gt;and its descendant URLs, so the changes that I need to make looks something like the pasted.&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;IPermission&lt;/SPAN&gt; &lt;SPAN class=attr&gt;class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="WebPermission"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ConnectAccess&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
     &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;URI&lt;/SPAN&gt; &lt;SPAN class=attr&gt;uri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://www\.live\.com/.*"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ConnectAccess&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;IPermission&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;The default URL for requests in medium trust config is set to &lt;EM&gt;$OriginHost$&lt;/EM&gt; which says, "Can't let you do request to domains other than your own :-)" . The URL property takes regular expression and I can grant as many as URLs I want just by adding a new URL element and associating it with proper endpoint that my API or application might call.&amp;nbsp; You can download the sample &lt;A href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Makingcrossdom.netwithmediumtrustenabled_11F29/MediumTrustDemo_1.zip" target=_blank mce_href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/Makingcrossdom.netwithmediumtrustenabled_11F29/MediumTrustDemo_1.zip"&gt;here&lt;/A&gt; and hope that helps a bit.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Update : As most of the shared hosting are with &amp;lt;location allowOverride="false"&amp;gt; the approach is useful only if you are a system administrator or want to&amp;nbsp;have full control over your site by restricting your widget developers to a limited URLs&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Enjoy !!!&lt;/P&gt;&lt;A href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2008%2f12%2f07%2fmaking-cross-domain-web-requests-in-asp-net-with-medium-trust-enabled.aspx"&gt;&lt;IMG alt="kick it on &amp;#13;&amp;#10;DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2008%2f12%2f07%2fmaking-cross-domain-web-requests-in-asp-net-with-medium-trust-enabled.aspx" border=0&gt;&lt;/A&gt; 
&lt;STYLE type=text/css&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6769729" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=RPIWvtTr"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=Y7hNtIpy"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=NniorEMR"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=KsR390ki"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=KsR390ki" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/OFUafy-Sslw" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/General/default.aspx">General</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Server/default.aspx">Server</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/System+Administration/default.aspx">System Administration</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2008/12/07/making-cross-domain-web-requests-in-asp-net-with-medium-trust-enabled.aspx</feedburner:origLink></item><item><title>Working out with Amazon S3</title><link>http://feedproxy.google.com/~r/burncsharp/~3/7ObRs8Xm2M4/working-out-with-amazon-s3.aspx</link><pubDate>Sun, 30 Nov 2008 17:08:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6760864</guid><dc:creator>mehfuzh</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6760864</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6760864</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2008/11/30/working-out-with-amazon-s3.aspx#comments</comments><description>&lt;P&gt;Recently, I was bit playing around with amazon S3. This is said to be the cheapest storage for people who don't want to spend much of their brain cells thinking about DB issues. Now, Amazon S3 primarily supports Web service (SOAP) to store and query data out of the S3 server. The concept behind S3 is that you have to create a bucket and under it you can store as many objects you want. Generally for a particular account 100 is the threshold value for buckets. In this post, I will basically focus on configuring your proxy for uploading large files to amazon using WSE and optionally I will point out a cool browser extension for analyzing your S3 space and third party library alternative.&lt;/P&gt;
&lt;P&gt;Amazon depends on WSE 2.0 if you want to upload files larger than 1MB. The large file is transferred in the form of DIME (Direct Internet Message Encapsulation) attachment. Microsoft has released WSE 3.0 that uses MTOM which is a W3C recommendation for replacing DIME. But the time of writing this post it is not yet supported by Amazon.&lt;/P&gt;
&lt;P&gt;How to prepare your proxy to support DIME&amp;nbsp; ?&amp;nbsp; Well, first you have to get the WSE 2.0 SP3 from Microsoft downloads. Once the step is completed, you can copy the Microsoft.Web.Services2.dll to your local folder. Basically, once the WSE 2.0 pack is installed the DLL is added to the GAC so it is not a required step, but if you want to ship it along with your distribution then you can consider doing that.&lt;/P&gt;
&lt;P&gt;Now once you have created the proxy from &lt;EM&gt;http://s3.amazonaws.com/doc/2006-03-01/AmazonS3.wsdl.&lt;/EM&gt; You need to do some manual tweaks before your project is ready to go with WSE. &lt;/P&gt;
&lt;P&gt;From the Diff for &lt;EM&gt;Reference.cs&lt;/EM&gt; we can see that we have to add a reference to Microsoft.Web.Services2 and inherit from WebServicesClientProtocol instead of SoapHttpClientProtocol&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/ReferenceDiff_1.jpg" mce_href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/ReferenceDiff_1.jpg"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=274 alt=ReferenceDiff src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/ReferenceDiff_thumb_1.jpg" width=521 border=0 mce_src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/ReferenceDiff_thumb_1.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Pretty easy but hang on a bit. While you are instantiating the proxy class you have to add/remove some standard WS filters. Therefore, if we have a method called CreateProxyInstance , with the OutputFilters it will look like&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; AmazonS3 CreateProxyInstance()
{
    AmazonS3 proxy = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; AmazonS3();

    &lt;SPAN class=rem&gt;/// Remove the standard WSE soap headers.&lt;/SPAN&gt;
    proxy.Pipeline.OutputFilters.Remove(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(Microsoft.Web.Services2.Security.SecurityOutputFilter));
    proxy.Pipeline.OutputFilters.Remove(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(Microsoft.Web.Services2.Referral.ReferralOutputFilter));
    proxy.Pipeline.OutputFilters.Remove(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(Microsoft.Web.Services2.Policy.PolicyEnforcementOutputFilter));

    &lt;SPAN class=rem&gt;/// Add our custom filter to remove the unwanted WSE soap headers.&lt;/SPAN&gt;
    proxy.Pipeline.OutputFilters.Add(&lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; HeaderOutputFilter(&lt;SPAN class=str&gt;"wsa:"&lt;/SPAN&gt;));

    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; proxy;
}&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P&gt;Here the HeaderOuputFilter is a inherited from SoapOutputFilter , where we build the SoapEnvolop header without &lt;EM&gt;wsa &lt;/EM&gt;node. Pretty much that's it for setting up the proxy , now let's upload something to the S3 server.&lt;/P&gt;&lt;PRE class=csharpcode&gt;MetadataEntry[] metadataEntries = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; MetadataEntry[2];

metadataEntries[0] = mContentType;
metadataEntries[1] = contentLength;

DateTime timestamp = GetCurrentTimeInMilliseconds();
&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; signature = GenerateSignature(&lt;SPAN class=str&gt;"PutObject"&lt;/SPAN&gt;, timestamp);

&lt;SPAN class=kwrd&gt;using &lt;/SPAN&gt;(AmazonS3 proxy = CreateProxyInstance())
{
    MemoryStream stream = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; MemoryStream(content);
    Microsoft.Web.Services2.Dime.DimeAttachment dimeAttachment = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; 
    Microsoft.Web.Services2.Dime.DimeAttachment(&lt;SPAN class=str&gt;"S3Object"&lt;/SPAN&gt;,   
    Microsoft.Web.Services2.Dime.TypeFormat.Unknown, stream);
    dimeAttachment.ContentType = contentType; &lt;/PRE&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=rem&gt;/// add the object in wire.&lt;/SPAN&gt;
    proxy.RequestSoapContext.Attachments.Add(dimeAttachment);
    proxy.PutObject(_bucketName, key, metadataEntries, content.LongLength, grants, 
    StorageClass.STANDARD, &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;, _accessKey, timestamp, &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;, signature, &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;);
}&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P&gt;From the fragmented code block we can see that "PutObject" is the method for large content not "PutObjectInLine" and along passing the stream, we have to pass the content type as well or less it wont recognized properly even you specify it in the MimeDataEntry array. &lt;/P&gt;
&lt;P&gt;So far that is all. I have joined in a tiny class library project that will be helpful if you are getting started with S3 using SOAP. You can download it &lt;A href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/AmazonStorage_1.zip" target=_self mce_href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/AmazonStorage_1.zip"&gt;HERE.&lt;/A&gt; About the tool there is a cool firefox addon called &lt;STRONG&gt;S3Fox&lt;/STRONG&gt; that gives you an explorer look for analyzing and even let you to add/delete items directly from S3.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/s3Fox_2.jpg" mce_href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/s3Fox_2.jpg"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=217 alt=s3Fox src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/s3Fox_thumb.jpg" width=381 border=0 mce_src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/WorkingoutwithAmazonS3_13398/s3Fox_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Finally, WSE 2.0 does not work in medium trust mode which is an absolute show stopper for CMS and blog solutions. There is a nice S3 library at codeplex can be found at &lt;A href="http://www.codeplex.com/ThreeSharp" target=_blank mce_href="http://www.codeplex.com/ThreeSharp"&gt;www.codeplex.com/ThreeSharp&lt;/A&gt; that don't requires any of these and can be a good alternative for medium trust problem.&lt;/P&gt;
&lt;P&gt;Enjoy !!!&lt;/P&gt;&lt;A href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2008%2f11%2f30%2fworking-out-with-amazon-s3.aspx" mce_href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2008%2f11%2f30%2fworking-out-with-amazon-s3.aspx"&gt;&lt;IMG alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2008%2f11%2f30%2fworking-out-with-amazon-s3.aspx" border=0 mce_src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fmehfuzh%2farchive%2f2008%2f11%2f30%2fworking-out-with-amazon-s3.aspx"&gt;&lt;/A&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6760864" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=UsuDCUyj"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=jY9ITS5H"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=8NPnA5vr"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=G5viCp8x"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=G5viCp8x" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/7ObRs8Xm2M4" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/S3/default.aspx">S3</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Amazon/default.aspx">Amazon</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2008/11/30/working-out-with-amazon-s3.aspx</feedburner:origLink></item><item><title>Retrospective of PDC 2008 [From my view]</title><link>http://feedproxy.google.com/~r/burncsharp/~3/3MqCYFC7wLU/retrospective-of-pdc-2008-from-my-view.aspx</link><pubDate>Sun, 09 Nov 2008 07:34:22 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6727131</guid><dc:creator>mehfuzh</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6727131</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6727131</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2008/11/09/retrospective-of-pdc-2008-from-my-view.aspx#comments</comments><description>&lt;p&gt;This happens to be the first PDC for me. This year a lot of new technologies has been unveiled during the keynotes. One of the most focused is the Windows Azure. This happens to be the one stop shop for building and deploying your service oriented application from local to remote. We all know how slow it is to build service oriented application these days and Windows Azure is just the right tool that can make life easier over the course of time. There is a breakout session by Steve Mark that you might like to checkout if you have missed it. The session is a starting point for setting up your first Windows Azure app and it also shows a way to work with Asp.net MVC for things like uploading photos. Also, I found that you can use Azure for building async based queue service easily with asp.net.&lt;/p&gt;  &lt;p&gt;Secondly , with C# 4.0 one of the cool feature that I found is the &lt;em&gt;dynamic&lt;/em&gt; keyword. Let's say you have the following simple class&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Math
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Add (&lt;span class="kwrd"&gt;int&lt;/span&gt; x, &lt;span class="kwrd"&gt;int&lt;/span&gt; y)
    {
         &lt;span class="kwrd"&gt;return&lt;/span&gt; x + y;
    }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;font color="#0000ff"&gt;float&lt;/font&gt; Add (&lt;span class="kwrd"&gt;float&lt;/span&gt; x, &lt;span class="kwrd"&gt;float&lt;/span&gt; y)
    {
         &lt;span class="kwrd"&gt;return&lt;/span&gt; x + y;
    }
}&lt;/pre&gt;

&lt;p&gt;&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;Now , as you can see there are two overloads for&lt;em&gt; Add. &lt;/em&gt;One is with int and another with float. With the current C# 3.5 (for non generic classes) you need to do&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Math math = &lt;span class="kwrd"&gt;new&lt;/span&gt; Math();
Type mType = math.GetType();

&lt;span class="kwrd"&gt;object&lt;/span&gt; result = mType.InvokeMember(&lt;span class="str"&gt;&amp;quot;Add&amp;quot;&lt;/span&gt;, BindingFlags.InvokeMethod, &lt;span class="kwrd"&gt;null&lt;/span&gt;, math, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] {10, 20});
&lt;span class="kwrd"&gt;object&lt;/span&gt; resultFloat = mType.InvokeMember(&lt;span class="str"&gt;&amp;quot;Add&amp;quot;&lt;/span&gt;, BindingFlags.InvokeMethod, &lt;span class="kwrd"&gt;null&lt;/span&gt;, math, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { 10.5f, 20f });

Console.WriteLine(result);
Console.WriteLine(resultFloat);&lt;/pre&gt;

&lt;p&gt;Which of course the only way to call float and int overload depending on value type with existing solution. But with C# 4.0 you can also do the following&lt;/p&gt;

&lt;pre class="csharpcode"&gt;dynamic math= &lt;span class="kwrd"&gt;new&lt;/span&gt; Math();

Console.WriteLine (math.Add (10, 20));
Console.WriteLine (math.Add (10.5f, 20f));&lt;/pre&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;As we can see that no &lt;em&gt;invoke &lt;/em&gt;method or &lt;em&gt;generics &lt;/em&gt;is ever required to call overloads with different type.You can find&amp;#160; more interesting stuffs on C# 4.0 from the cool session by Anders Hejlsberg, if you at any chance missed it.&lt;/p&gt;

&lt;p&gt;PDC 2008 is the event for windows 7. It is supplied to all the attendees with the 160GB mobile hard-drive and of course as a DVC copy. The most cool thing is to be able to add &lt;em&gt;vhds&lt;/em&gt; as logical drives and being able to set them as primary drive to boot in native mode. Most of the feature shown in the PDC keynotes are by default in protected mode, so you might need to do tweaks for it.&lt;/p&gt;

&lt;p&gt;Finally, &amp;quot;M&amp;quot; is the language for defining your domain model and &amp;quot;Quadrant&amp;quot; is a nice tool that harnesses the &amp;quot;M&amp;quot; to design and persist complex domain model visually. Together they are the &amp;quot;Oslo&amp;quot; project. Try the three parts session from microsoftPdc dot com.&lt;/p&gt;

&lt;p&gt;In the end, with Microsoft Surface setup in different places of the convention center with people participating in &amp;quot;Scavenger Hunt&amp;quot; challenge, cool product showcase by various players at Microsoft ecosystem and PDC dinner at Universal Studios really made things rocking. May be next PDC will be even more exciting with beta products coming out to life ;).&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6727131" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=25G7wu3T"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=9a16SyB5"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=x8Sjq4Jh"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=RynPYWpR"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=RynPYWpR" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/3MqCYFC7wLU" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/PDC+08/default.aspx">PDC 08</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/C_2300_+4.0/default.aspx">C# 4.0</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2008/11/09/retrospective-of-pdc-2008-from-my-view.aspx</feedburner:origLink></item><item><title>I am here at PDC 2008</title><link>http://feedproxy.google.com/~r/burncsharp/~3/kx9NRewYJd0/i-am-here-at-pdc-2008.aspx</link><pubDate>Sun, 26 Oct 2008 09:50:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6704600</guid><dc:creator>mehfuzh</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/mehfuzh/rsscomments.aspx?PostID=6704600</wfw:commentRss><wfw:comment>http://weblogs.asp.net/mehfuzh/commentapi.aspx?PostID=6704600</wfw:comment><comments>http://weblogs.asp.net/mehfuzh/archive/2008/10/26/i-am-here-at-pdc-2008.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;a href="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/IamhereatPDC2008_1F5E/dev_2.jpg"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="dev" src="http://weblogs.asp.net/blogs/mehfuzh/WindowsLiveWriter/IamhereatPDC2008_1F5E/dev_thumb.jpg" width="164" height="220" /&gt;&lt;/a&gt;&lt;/p&gt; Finally, PDC 2008 is going to roll on this Monday, when Ray Ozzie will start the show off with his keynote. This year there will be quite a new things to be announced during the show. There will be first time preview of Windows 7 and Microsoft's new modeling platform Oslo. There will be C# 4.0 talks , Asp.net MVC and more. All these will be covered in couple of keynotes and a load of sessions during the PDC week. Also, there will be some book singing events where Anders Hejlsberg will be signing copies of the C# Programming Language. I am a part of the &lt;a target="_blank" href="http://www.telerik.com/"&gt;Telerik&lt;/a&gt; PDC crew and it is all fun starting from setting up booth (you must try it to feel the joy :-), team work and IKEA stuffs.) with the team and meeting cool dev's. As many of you know that the soft copy of the early build of windows 7 will be delivered though a 160GB mobile hard-rive&amp;#160; which is really cool. Finally, PDC is never been fun without Scott Guthrie, Scott Hanselman, Don Box, Chris Anderson with their cool keynotes and sessions.   &lt;br /&gt;  &lt;br /&gt;This year Microsoft will be focusing on cloud computing platforms (Dublin and .net services), which is growing popular these days with plenty of API's flying around. I will keep you guys what I learn from the event and about cloud computing.   &lt;p&gt;Some of my favorite sessions follows &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Day 1&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Some of my Key interest sessions follows&lt;/p&gt;  &lt;p&gt;TL16 The Future of C# by Anders Hejlsberg&lt;/p&gt;  &lt;p&gt;TL40 &amp;quot;Dublin&amp;quot; and .NET Services: Extending On-Premises Applications to the Cloud&lt;/p&gt;  &lt;p&gt;PC20 ASP.NET 4.0 Roadmap By Scott Hunter&lt;/p&gt;  &lt;p&gt;PC21 ASP.NET MVC: A New Framework for Building Web Applications by Phill Haack&lt;/p&gt;  &lt;p&gt;PC58 Framework Design Guidelines by Brad Adams&lt;/p&gt;  &lt;p&gt;TL49 Microsoft .NET Framework: Overview and Applications for Babies by Scott Hanselman&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Day 2&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;TL27 &amp;quot;Oslo&amp;quot;: The Language by Don Box&lt;/p&gt;  &lt;p&gt;PC31 ASP.NET and JQuery by Stephen Walther&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Day 3&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;BB24 SQL Server 2008: Deep Dive into Spatial Data by Isaac Kunen&lt;/p&gt;  &lt;p&gt;TL18 &amp;quot;Oslo&amp;quot;: Customizing and Extending the Visual Design Experience by Don Box&lt;/p&gt;  &lt;p&gt;PC54 Mono and .NET by Miguel de Icaza&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Day 4&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;TL32 Microsoft Visual Studio: Customizing and Extending the Development Environment&lt;/p&gt;  &lt;p&gt;TL31 &amp;quot;Oslo&amp;quot;: Building Textual DSLs by Chris Anderson&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;These are only few. More I will decide on demand :-)&amp;#160; Apart from PDC I am really enjoying my stay at LA, its a nice place properly choreographed and I like it all. If you are coming to PDC want to say Hi, or you want me to do that as well. I will be around at the Telerik Booth and of course in the sessions and keynote halls. By the way, today I found that there will be Microsoft Surface booth. Therefore, it will be cool to play around them as well.&lt;/p&gt;  &lt;p&gt;If you are not in PDC , don't worry&amp;#160; you can enjoy all of it sitting in-front of your laptop. You can download keynotes and sessions from PDC site. That's all I can remember now and will keep you posted about my experience.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6704600" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=w9sfJ79z"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=5dGO4QVA"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=mJgmpocY"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/burncsharp?a=Gkf5oXdE"&gt;&lt;img src="http://feeds.feedburner.com/~f/burncsharp?i=Gkf5oXdE" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/burncsharp/~4/kx9NRewYJd0" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/mehfuzh/archive/tags/PDC+08/default.aspx">PDC 08</category><feedburner:origLink>http://weblogs.asp.net/mehfuzh/archive/2008/10/26/i-am-here-at-pdc-2008.aspx</feedburner:origLink></item></channel></rss>
