<?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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Omar AL Zabir blog on ASP.NET Ajax and .NET 3.5</title><link>http://msmvps.com/blogs/omar/default.aspx</link><description>Working hard to enrich millions of peoples&amp;#39; lives</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/OmarAlZabirBlog" type="application/rss+xml" /><feedburner:emailServiceId>OmarAlZabirBlog</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%2FOmarAlZabirBlog" 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%2FOmarAlZabirBlog" 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%2FOmarAlZabirBlog" 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/OmarAlZabirBlog" 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%2FOmarAlZabirBlog" 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%2FOmarAlZabirBlog" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FOmarAlZabirBlog" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.addtoany.com/?linkname=Omar%20AL%20Zabir%20blog%20on%20ASP.NET%20Ajax%20and%20.NET%203.5&amp;linkurl=http%3A%2F%2Ffeeds.feedburner.com%2FOmarAlZabirBlog&amp;type=feed" src="http://www.addtoany.com/addfr-b.gif">Add to Any Feed Reader</feedburner:feedFlare><feedburner:browserFriendly>A blog about my discoveries and innovations on ASP.NET, AJAX, Web site performance and scalability, production challenges and powershell tools. I also share stories from my day-to-day operation experience on running a high volume Web 2.0 Application</feedburner:browserFriendly><item><title>MSDN Day @ Dhaka</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/zrsF0EqMDJs/msdn-day-dhaka.aspx</link><pubDate>Wed, 17 Jun 2009 08:53:57 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1695686</guid><dc:creator>omar</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1695686</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2009/06/17/msdn-day-dhaka.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/events/default.aspx">events</category><description>Venue.     
IDB Auditorium     
E/8-A Rokeya Sharani,     
Sher-e-Bangla Nagar,     
Agargaon, Dhaka 1207  
Saturday June 20th 9:00 AM to 6:00 PM  
Microsoft Community in Bangladesh proudly presents Microsoft Day @ Dhaka. This is a special day dedicated to all Microsoft technology professionals and students in Bangladesh. We will be having the best Microsoft community technologists from Bangladesh - Microsoft Most Valuable Professionals (MVPs) delivering sessions at the event. This technology marathon is a great opportunity to learn from the best and network with each other.    
Both Microsoft developers and networking professionals would find the event worth attending.     
The event will also feature a demo bonanza with Windows 7 and an extensive Question and Answer panel with the Bangladesh MVPs to answer your queries.   
http://msdnbangladesh.net/content/msday.aspx  
Please register soon! Limited sits. I have a session there as well.  
&amp;#160;  
AUDITORIUM – Dev Track  
9:00 - 9:30: Opening Speech - Feroz Mahmood  
9:30 - 10:30: Development in ASP.NET [LINQ, Web Forms, Dynamic Data] - Tanzim Saqib  
10:30 - 11:15: My First ASP.NET MVC App - Mehfuz Hossain  
11:15 - 11:45 : Unit Testing in MVC and Demo of dotnetshoutouts.com - Kazi Manzur Rashid  
11:45- 12:30: Developing in Silverlight - Faisal Hossain Khan   
12:30 - 1:30: Lunch  
1:30 - 2:00 : Introduction to Sharepoint/ MOSS - Jannatul Ferdous  
2:00 - 2:45: Production Challenges of ASP.NET Websites - Omar Al Zabir  
2:45 - 3:15: Windows Azure - Ashic  
3:15 - 3:45: Tea Break  
3:45 - 4:30:&amp;#160; Overview of Visual Studio Team System 2010 - Mohammad Ashraful Alam  
4:30 - 5:30:&amp;#160;&amp;#160; Features of Windows 7 - IE8 and Windows Live Features - Omi Azad  
BREAK OUT – IT Pro Track  
9:00 - 9:30: Opening Speech - Feroz Mahmood [IN AUDITORIUM]  
9:30 – 10:30: Exchange Server 2010  
10:30 - 11:30: Windows Server 2008 - Virtualisation &amp;amp; HyperV  
11:30 - 12:30: Talking Windows Server 2008 and R2 [Windows Client &amp;amp; Windows Server 2008 NAP – Better Together] - Anwar Hossain (Technical Specialist, MS Bangladesh)  
12:30 - 1:30: Lunch  
1:30 - 2:15:&amp;#160; Session on MS Project &amp;amp; EPM : M. Manzurur Rahman (CEO, ICT Alliance)  
2:15 - 3:00: Office 2007   
3:00 - 3:30: Tea Break  
3:30 - 4:30:&amp;#160; Introduction to SQL Server 2008  
4:30 - 5:30:&amp;#160;&amp;#160; Features of Windows 7 - IE8 and Windows Live Features - Omi Azad [IN AUDITORIUM]&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=zrsF0EqMDJs:msMnaB_O5w8:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=zrsF0EqMDJs:msMnaB_O5w8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=zrsF0EqMDJs:msMnaB_O5w8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zrsF0EqMDJs:msMnaB_O5w8:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/zrsF0EqMDJs" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2009/06/17/msdn-day-dhaka.aspx</feedburner:origLink></item><item><title>ASP.NET AJAX testing made easy using Visual Studio 2008 Web Test</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/Z2mwDWK93Bg/asp-net-ajax-testing-made-easy-using-visual-studio-2008-web-test.aspx</link><pubDate>Mon, 25 May 2009 11:44:32 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693085</guid><dc:creator>omar</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1693085</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2009/05/25/asp-net-ajax-testing-made-easy-using-visual-studio-2008-web-test.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/ajax/default.aspx">ajax</category><category domain="http://msmvps.com/blogs/omar/archive/tags/testing/default.aspx">testing</category><description>Visual Studio 2008 comes with rich Web Testing support, but it’s not rich enough to test highly dynamic AJAX websites where the page content is generated dynamically from database and the same page output changes very frequently based on some external data source e.g. RSS feed. Although you can use the Web Test Record feature to record some browser actions by running a real browser and then play it back. But if the page that you are testing changes everytime you visit the page, then your recorded tests no longer work as expected. The problem with recorded Web Test is that it stores the generated ASP.NET Control ID, Form field names inside the test. If the page is no longer producing the same ASP.NET Control ID or same Form fields, then the recorded test no longer works. A very simple example is in VS Web Test, you can say “click the button with ID ctrl00_UpdatePanel003_SubmitButton002”, but you cannot say “click the 2nd Submit button inside the third UpdatePanel”. Another key limitation is in Web Tests, you cannot address Controls using the Server side Control ID like “SubmitButton”. You have to always use the generated Client ID which is something weird like “ctrl_00_SomeControl001_SubmitButton”. Moreover, if you are making AJAX calls where certain call returns some JSON or updates some UpdatePanel and then based on the server returned response, you want to make further AJAX calls or post the refreshed UpdatePanel, then recorded tests don’t work properly. You *do* have the option to write the tests hand coded and write code to handle such scenario but it’s pretty difficult to write hand coded tests when you are using UpdatePanels because you have to keep track of the page viewstates, form hidden variables etc across async post backs. So, I have built a library that makes it significantly easier to test dynamic AJAX websites and UpdatePanel rich web pages. There are several ExtractionRule and ValidationRule available in the library which makes testing Cookies, Response Headers, JSON output, discovering all UpdatePanel in a page, finding controls in the response body, finding controls inside some UpdatePanel all very easy.  
First, let me give you an example of what can be tested using this library. My open source project Dropthings produces a Web 2.0 Start Page where the page is composed of widgets.   
  
Each widget is composed of two UpdatePanel. There’s a header area in each widget which is one UpdatePanel and the body area is another UpdatePanel. Each widget is rendered from database using the unique ID of the widget row, which is an INT IDENTITY. Every page has unique widgets, with unique ASP.NET Control ID. As a result, there’s no way you can record a test and play it back because none of the ASP.NET Control IDs are ever same for the same page on different visits. This is where my library comes to the rescue.  
See the web test I did:  
  
This test simulates an anonymous user visit. When anonymous user visits Dropthings for the first...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Z2mwDWK93Bg:aatI4Djkmto:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Z2mwDWK93Bg:aatI4Djkmto:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Z2mwDWK93Bg:aatI4Djkmto:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Z2mwDWK93Bg:aatI4Djkmto:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/Z2mwDWK93Bg" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2009/05/25/asp-net-ajax-testing-made-easy-using-visual-studio-2008-web-test.aspx</feedburner:origLink></item><item><title>Web 2.0 AJAX Portal using jQuery, ASP.NET 3.5, Silverlight, Linq to SQL, WF and Unity</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/i4nIiY2Tnqo/web-2-0-ajax-portal-using-jquery-asp-net-3-5-silverlight-linq-to-sql-wf-and-unity.aspx</link><pubDate>Wed, 08 Apr 2009 18:16:22 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1685991</guid><dc:creator>omar</dc:creator><slash:comments>8</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1685991</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2009/04/08/web-2-0-ajax-portal-using-jquery-asp-net-3-5-silverlight-linq-to-sql-wf-and-unity.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/linq/default.aspx">linq</category><category domain="http://msmvps.com/blogs/omar/archive/tags/workflow/default.aspx">workflow</category><category domain="http://msmvps.com/blogs/omar/archive/tags/javascript/default.aspx">javascript</category><category domain="http://msmvps.com/blogs/omar/archive/tags/ajax/default.aspx">ajax</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/silverlight/default.aspx">silverlight</category><description>Dropthings – my open source Web 2.0 Ajax Portal has gone through a technology overhauling. Previously it was built using ASP.NET AJAX, a little bit of Workflow Foundation and Linq to SQL. Now Dropthings boasts full jQuery front-end combined with ASP.NET AJAX UpdatePanel, Silverlight widget, full Workflow Foundation implementation on the business layer, 100% Linq to SQL Compiled Queries on the data access layer, Dependency Injection and Inversion of Control (IoC) using Microsoft Enterprise Library 4.1 and Unity. It also has a ASP.NET AJAX Web Test framework that makes it real easy to write Web Tests that simulates real user actions on AJAX web pages. This article will walk you through the challenges in getting these new technologies to work in an ASP.NET website and how performance, scalability, extensibility and maintainability has significantly improved by the new technologies. Dropthings has been licensed for commercial use by prominent companies including BT Business, Intel, Microsoft IS, Denmark Government portal for Citizens; Startups like Limead and many more. So, this is serious stuff! There’s a very cool open source implementation of Dropthings framework available at National University of Singapore portal.  
Visit: http://dropthings.omaralzabir.com  
  
I have published a new article on this on CodeProject:  
http://www.codeproject.com/KB/ajax/Web20Portal.aspx  Get the source code  
Latest source code is hosted at Google code:  
http://code.google.com/p/dropthings  
There’s a CodePlex site for documentation and issue tracking:  
http://www.codeplex.com/dropthings  
You will need Visual Studio 2008 Team Suite with Service Pack 1 and Silverlight 2 SDK in order to run all the projects. If you have only Visual Studio 2008 Professional, then you will have to remove the Dropthings.Test project.  New features introduced  
Dropthings new release has the following features:     Template users – you can define a user who’s pages and widgets are used as a template for new users. Whatever you put in that template user’s pages, it will be copied for every new user. Thus this is an easier way to define the default pages and widgets for new users. Similarly you can do the same for a registered user. The template users can be defined in the web.config.     Widget-to-Widget communication – Widgets can send message to each other. Widgets can subscribe to an Event Broker and exchange messages using a Pub-Sub pattern.     WidgetZone – you can create any number of zones in any shape on the page. You can have widgets laid in horizontal layout, you can have zones on different places on the page and so on. With this zone model, you are no longer limited to the Page-Column model where you could only have N vertical columns.     Role based widgets – now widgets are mapped to roles so that you can allow different users to see different widget list using ManageWidgetPersmission.aspx.     Role based page setup – you can define page setup for different roles. For...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=i4nIiY2Tnqo:mYjpzi3TiFg:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=i4nIiY2Tnqo:mYjpzi3TiFg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=i4nIiY2Tnqo:mYjpzi3TiFg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=i4nIiY2Tnqo:mYjpzi3TiFg:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/i4nIiY2Tnqo" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2009/04/08/web-2-0-ajax-portal-using-jquery-asp-net-3-5-silverlight-linq-to-sql-wf-and-unity.aspx</feedburner:origLink></item><item><title>Memory Leak with delegates and workflow foundation</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/-LIRJgSGBXo/memory-leak-with-delegates-and-workflow-foundation.aspx</link><pubDate>Sat, 14 Mar 2009 08:35:53 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1678020</guid><dc:creator>omar</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1678020</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2009/03/14/memory-leak-with-delegates-and-workflow-foundation.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/linq/default.aspx">linq</category><category domain="http://msmvps.com/blogs/omar/archive/tags/workflow/default.aspx">workflow</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><description>Recently after Load Testing my open source project Dropthings, I encountered a lot of memory leak. I found lots of Workflow Instances and Linq Entities were left in memory and never collected. After profiling the web application using .NET Memory Profiler, it showed the real picture:  
  
It shows you that instances of the several types are being created but not being removed. You see the “New” column has positive value, but the “Remove” column has 0. That means new instances are being created, but not removed. Basically the way you do Memory Profiling is, you take two snapshots. Say you take one snapshot when you first visit your website. Then you do some action on the website that results in allocation of objects. Then you take another snapshot. When you compare both snapshots, you can see how many instances of classes were created between these two snapshots and how many were removed. If they are not equal, then you have leak. Generally in web application many objects are created on every page hit and the end of the request, all those objects are supposed to be released. If they are not released, then we have a problem. But that’s the scenario for desktop applications because in a desktop application, objects can remain in memory until app is closed. But you should know best from the code which objects were supposed to go out of scope and get released.  
For beginners, leak means objects are being allocated but not being freed because someone is holding reference to the objects. When objects leak, they remain in memory forever, until the process (or app domain) is closed. So, if you have a leaky website, your website is continuously taking up memory until it runs out of memory on the web server and thus crash. So, memory leak is a bad – it prevents you from running your product for long duration and requires frequent restart of app pool.   
So, the above screenshot shows Workflow and Linq related classes are not being removed, and thus leaking. This means somewhere workflow instances are not being released and thus all workflow related objects are remaining. You can see the number is same 48 for all workflow related objects. This is a good indication that, almost every instance of workflow is leaked because there were total 48 workflows created and ran. Moreover it indicates we have a leak from a top Workflow instance level, not in some specific Activity or somewhere deep in the code.  
As the workflows use Linq stuff, they held reference to the Linq stuffs and thus the Linq stuffs leaked as well. Sometimes you might be looking for why A is leaking. But you actually end up finding that since B was holding reference to A and B was leaking and thus A was leaking as well. This is sometimes tricky to figure out and you spend a lot of time looking at the wrong direction.  
Now let me show you the buggy code:  ManualWorkflowSchedulerService manualScheduler = 
  workflowRuntime.GetService&amp;lt;ManualWorkflowSchedulerService&amp;gt;();

WorkflowInstance...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=-LIRJgSGBXo:uk3bMbquKhU:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=-LIRJgSGBXo:uk3bMbquKhU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=-LIRJgSGBXo:uk3bMbquKhU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=-LIRJgSGBXo:uk3bMbquKhU:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/-LIRJgSGBXo" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2009/03/14/memory-leak-with-delegates-and-workflow-foundation.aspx</feedburner:origLink></item><item><title>Optimize ASP.NET Membership Stored Procedures for greater speed and scalability</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/dddCH2jA0Qk/optimize-asp-net-membership-stored-procedures-for-greater-speed-and-scalability.aspx</link><pubDate>Fri, 13 Mar 2009 13:23:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1678004</guid><dc:creator>omar</dc:creator><slash:comments>7</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1678004</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2009/03/13/optimize-asp-net-membership-stored-procedures-for-greater-speed-and-scalability.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><description>Last year at Pageflakes, when we were getting millions of hits per day, we were having query timeout due to lock timeout and Transaction Deadlock errors. These locks were produced from aspnet_Users and aspnet_Membership tables. Since both of these tables are very high read (almost every request causes a read on these tables) and high write (every anonymous visit creates a row on aspnet_Users), there were just way too many locks created on these tables per second. SQL Counters showed thousands of locks per second being created. Moreover, we had queries that would select thousands of rows from these tables frequently and thus produced more locks for longer period, forcing other queries to timeout and thus throw errors on the website.

If you have read my last blog post, you know why such locks happen. Basically every table when it grows up to hold millions of records and becomes popular goes through this trouble. It&amp;rsquo;s just a part of scalability problem that is common to database. But we rarely take prevention about it in our early design.

The solution is simple, you should either have WITH (NOLOCK) or SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED before SELECT queries. Either of this will do. They tell SQL Server not to hold any lock on the table while it is reading the table. If some row is locked while the read is happening, it will just ignore that row. When you are reading a table thousand times per second, without these options, you are issuing lock on many places around the table thousand times per second. It not only makes read from table slower, but also so many lock prevents insert, update, delete from happening timely and thus queries timeout. If you have queries like &amp;ldquo;show the currently online users from last one hour based on LastActivityDate field&amp;rdquo;, that is going to issue such a wide lock that even other harmless select queries will timeout. And did I tell you that there&amp;rsquo;s no index on LastActivityDate on aspnet_Users table?

Now don&amp;rsquo;t blame yourself for not putting either of these options on your every stored proc and every dynamically generated SQL from the very first day. ASP.NET developers made the same mistake. You won&amp;rsquo;t see either of these used in any of the stored procs used by ASP.NET Membership. For example, the following stored proc gets called whenever you access Profile object:
ALTER PROCEDURE [dbo].[aspnet_Profile_GetProperties]
    @ApplicationName      nvarchar(256),
    @UserName             nvarchar(256),
    @CurrentTimeUtc       datetime
AS
BEGIN

    DECLARE @ApplicationId uniqueidentifier
    SELECT  @ApplicationId = NULL
    SELECT  @ApplicationId = ApplicationId FROM 
      dbo.aspnet_Applications WHERE LOWER(@ApplicationName) = LoweredApplicationName
    IF (@ApplicationId IS NULL)
        RETURN

    DECLARE @UserId uniqueidentifier
    DECLARE @LastActivityDate datetime
    SELECT  @UserId = NULL

    SELECT @UserId = UserId, @LastActivityDate = LastActivityDate
    FROM...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=dddCH2jA0Qk:tbN1TJrDKSA:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=dddCH2jA0Qk:tbN1TJrDKSA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=dddCH2jA0Qk:tbN1TJrDKSA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=dddCH2jA0Qk:tbN1TJrDKSA:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/dddCH2jA0Qk" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2009/03/13/optimize-asp-net-membership-stored-procedures-for-greater-speed-and-scalability.aspx</feedburner:origLink></item><item><title>Linq to SQL solve Transaction deadlock and Query timeout problem using uncommitted reads</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/zpw40Zu0jms/linq-to-sql-solve-transaction-deadlock-and-query-timeout-problem-using-uncommitted-reads.aspx</link><pubDate>Sat, 07 Mar 2009 07:30:52 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1676241</guid><dc:creator>omar</dc:creator><slash:comments>10</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1676241</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2009/03/07/linq-to-sql-solve-transaction-deadlock-and-query-timeout-problem-using-uncommitted-reads.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/linq/default.aspx">linq</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><description>When your database tables start accumulating thousands of rows and many users start working on the same table concurrently, SELECT queries on the tables start producing lock contentions and transaction deadlocks. This is a common problem in any high volume website. As soon as you start getting several concurrent users hitting your website that results in SELECT queries on some large table like aspnet_users table that are also being updated very frequently, you end up having one of these errors:     
Transaction (Process ID ##) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.    
Or,     
Timeout Expired. The Timeout Period Elapsed Prior To Completion Of The Operation Or The Server Is Not Responding.    
The solution to these problems are – use proper index on the table and use transaction isolation level Read Uncommitted or WITH (NOLOCK) in your SELECT queries. So, if you had a query like this:  SELECT * FORM aspnet_users 
where ApplicationID =’xxx’ AND LoweredUserName = &amp;#39;someuser&amp;#39;


You should end up having any of the above errors under high load. There are two ways to solve this:

SET TRANSACTION LEVEL READ UNCOMMITTED;
SELECT * FROM aspnet_Users 
WHERE ApplicationID =’xxx’ AND LoweredUserName = &amp;#39;someuser&amp;#39;





Or use the WITH (NOLOCK):

SELECT * FROM aspnet_Users WITH (NOLOCK) 
WHERE ApplicationID =’xxx’ AND LoweredUserName = &amp;#39;someuser&amp;#39;


The reason for the errors are that since aspnet_users is a high read and high write table, during read, the table is partially locked and during write, it is also locked. So, when the locks overlap on each other from several queries and especially when there’s a query that’s trying to read a large number of rows and thus locking large number of rows, some of the queries either timeout or produce deadlocks.


Linq to Sql does not produce queries with the WITH (NOLOCK) option nor does it use READ UNCOMMITTED. So, if you are using Linq to SQL queries, you are going to end up with any of these problems on production pretty soon when your site becomes highly popular.


For example, here’s a very simple query:

using (var db = new DropthingsDataContext())
{
    var user = db.aspnet_Users.First();
    var pages = user.Pages.ToList();
}


DropthingsDataContext is a DataContext built from Dropthings database.


When you attach SQL Profiler, you get this:


 


You see none of the queries have READ UNCOMMITTED or WITH (NOLOCK). 


The fix is to do this:

using (var db = new DropthingsDataContext2())
{
    db.Connection.Open();
    db.ExecuteCommand(&amp;quot;SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;&amp;quot;);

    var user = db.aspnet_Users.First();
    var pages = user.Pages.ToList();
}


This will result in the following profiler output



 


As you see, both queries execute within the same connection and the isolation level is set before the queries execute. So, both queries enjoy the isolation level.


Now there’s a...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=zpw40Zu0jms:EGhEU2SFyWQ:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=zpw40Zu0jms:EGhEU2SFyWQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=zpw40Zu0jms:EGhEU2SFyWQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=zpw40Zu0jms:EGhEU2SFyWQ:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/zpw40Zu0jms" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2009/03/07/linq-to-sql-solve-transaction-deadlock-and-query-timeout-problem-using-uncommitted-reads.aspx</feedburner:origLink></item><item><title>Strongly typed workflow input and output arguments</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/nOzECG83psk/strongly-typed-workflow-input-and-output-arguments.aspx</link><pubDate>Sat, 27 Dec 2008 15:05:45 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1657833</guid><dc:creator>omar</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1657833</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/12/27/strongly-typed-workflow-input-and-output-arguments.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/workflow/default.aspx">workflow</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/architecture/default.aspx">architecture</category><description>When you run a Workflow using Workflow Foundation, you pass arguments to the workflow in a Dictionary form where the type of Dictionary is Dictionary&amp;lt;string, object&amp;gt;. This means you miss the strong typing features of .NET languages. You have to know what arguments the workflow expects by looking at the Workflow public properties. Moreover, there’s no way to make arguments required. You pass parameter, expect it to run, if it throws exception, you pass more arguments, hope it works now. Similarly, if you are running workflow synchronously using ManualWorkflowSchedulerService, you expect return arguments from the Workflow immediately, but there again, you have to rely on the Dictionary key and value pair. No strong typing there as well.  
In order to solve this, so that you could pass Workflow arguments as strongly typed classes, you can establish a format that every Workflow has only two arguments named &amp;quot;Request” and “Response” and none other. Whatever needs to be passed to the Workflow and expected out of it, must be passed via Request and must be expected via Response properties. Now the type of these arguments can be workflow specific, it can be any class with one or more parameters. This way, you could write code like this:  
  
The advantages of these strongly typed approach are:      Compile time validation of input parameters passed to workflow. No risk of passing unexpected object in Dictionary’s object type value.    Enforce required values by creating Request objects with non-default constructor.    Establish a fixed contract for Workflow input and output via the strongly typed Request and Response classes or interfaces.    Validate input arguments for the Workflow directly from the Request class, without going through the overhead of running a workflow.   
If we follow this approach, we create workflows with only two DependencyProperty, one for Request and one for Response. Showing you an example from my open source project Dropthings, which uses Workflow for the entire Business Layer. Below you see the Workflow that executes when a new user visits Dropthings.com, creates a new user and setups all the pages and widgets for the user. It has only two Dependency property – Request and Response.  
   
The Request parameters is of type IUserVisitWorkflowRequest. So, you can pass any class as Request argument that implements the interface.   
   
Here I have used fancy inheritance to create Request object hierarchy. You don’t need to do that. Just remember, you can pass any class. You don’t even need to use interface for Request parameter. It can be a class directly. I use all these interfaces in order to facilitate Dependency Inversion.  
Similarly, the Response object is also a class.  
  
The Response returns quite some properties. So, it’s kinda handy to wrap them all in one property.  
So, there you have it, strongly typed Workflow arguments. You can attach properties of the Request object to any activity directly form the...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=nOzECG83psk:ZkqK3QKQmqM:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=nOzECG83psk:ZkqK3QKQmqM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=nOzECG83psk:ZkqK3QKQmqM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=nOzECG83psk:ZkqK3QKQmqM:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/nOzECG83psk" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/12/27/strongly-typed-workflow-input-and-output-arguments.aspx</feedburner:origLink></item><item><title>99.99% available ASP.NET and SQL Server SaaS Production Architecture</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/R5QvBFRfDKc/99-99-available-asp-net-and-sql-server-saas-production-architecture.aspx</link><pubDate>Wed, 10 Dec 2008 08:39:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1656383</guid><dc:creator>omar</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1656383</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/12/10/99-99-available-asp-net-and-sql-server-saas-production-architecture.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/pageflakes/default.aspx">pageflakes</category><category domain="http://msmvps.com/blogs/omar/archive/tags/production/default.aspx">production</category><category domain="http://msmvps.com/blogs/omar/archive/tags/architecture/default.aspx">architecture</category><description>You have a hot ASP.NET+SQL Server product, growing at thousand users per day and you have hit the limit of your own garage hosting capability. Now that you have enough VC money in your pocket, you are planning to go out and host on some real hosting facility, maybe a colocation or managed hosting. So, you are thinking, how to design a physical architecture that will ensure performance, scalability, security and availability of your product? How can you achieve four-nine (99.99%) availability? How do you securely let your development team connect to production servers? How do you choose the right hardware for web and database server? Should you use Storage Area Network (SAN) or just local disks on RAID? How do you securely connect your office computers to production environment?

Here I will answer all these queries. Let me first show you a diagram that I made for Pageflakes where we ensured we get four-nine availability. Since Pageflakes is a Level 3 SaaS, it&amp;rsquo;s absolutely important that we build a high performance, highly available product that can be used from anywhere in the world 24/7 and end-user gets quick access to their content with complete personalization and customization of content and can share it with others and to the world. So, you can take this production architecture as a very good candidate for Level 3 SaaS: 



Here&amp;rsquo;s a CodeProject article that explains all the ideas:

99.99% available ASP.NET and SQL Server SaaS Production Architecture

Hope you like it. Appreciate your vote.













&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=R5QvBFRfDKc:mqCjLkXCtpI:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=R5QvBFRfDKc:mqCjLkXCtpI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=R5QvBFRfDKc:mqCjLkXCtpI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=R5QvBFRfDKc:mqCjLkXCtpI:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/R5QvBFRfDKc" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/12/10/99-99-available-asp-net-and-sql-server-saas-production-architecture.aspx</feedburner:origLink></item><item><title>Linq to SQL: Delete an entity using Primary Key only</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/YXw8_xnXYOs/linq-to-sql-delete-an-entity-using-primary-key-only.aspx</link><pubDate>Thu, 30 Oct 2008 00:27:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1652462</guid><dc:creator>omar</dc:creator><slash:comments>17</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1652462</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/30/linq-to-sql-delete-an-entity-using-primary-key-only.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/linq/default.aspx">linq</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><description>Linq to Sql does not come with a function like .Delete(ID) which allows you to delete an entity using it&amp;rsquo;s primary key. You have to first get the object that you want to delete and then call .DeleteOnSubmit(obj) to queue it for delete. Then you have to call DataContext.SubmitChanges() to play the delete queries on database. So, how to delete object without getting them from database and avoid database roundtrip?

 

You can call this function using DeleteByPK&amp;lt;Employee, int&amp;gt;(10, dataContext);

First type is the entity type and second one is the type of the primary key. If your object&amp;rsquo;s primary key is a Guid field, specify Guid instead of int.

How it works:

It figures out the table name and the primary key field name from the entity 
Then it uses the table name and primary key field name to build a DELETE query 


Figuring out the table name and primary key field name is a bit hard. There&amp;rsquo;s some reflection involved. The GetTableDef&amp;lt;TSource&amp;gt;() returns the table name and primary key field name for an entity.

Every Linq Entity class is decorated with a Table attribute that has the table name:

 

Then the primary key field is decorated with a Column attribute with IsPrimaryKey = true.

 

So, using reflection we can figure out the table name and the primary key property and the field name.

Here&amp;rsquo;s the code that does it:

 

Before you scream &amp;ldquo;Reflection is SLOW!!!!&amp;rdquo; the definition is cached. So, reflection is used only once per appDomain per entity. Subsequent call is just a dictionary lookup away, which is as fast as it can get.

You can also delete a collection of object without ever getting any one of them. The the following function to delete a whole bunch of objects:

 

The code is available here:

http://code.msdn.microsoft.com/DeleteEntitiesLinq









&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=YXw8_xnXYOs:SIiDuFmSUOc:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=YXw8_xnXYOs:SIiDuFmSUOc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=YXw8_xnXYOs:SIiDuFmSUOc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=YXw8_xnXYOs:SIiDuFmSUOc:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/YXw8_xnXYOs" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/30/linq-to-sql-delete-an-entity-using-primary-key-only.aspx</feedburner:origLink></item><item><title>How to convince developers and management to use automated unit test for AJAX websites</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/fvJttJrO18w/how-to-convince-developers-and-management-to-use-automated-unit-test-for-ajax-websites.aspx</link><pubDate>Mon, 27 Oct 2008 14:00:24 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1652113</guid><dc:creator>omar</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1652113</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/27/how-to-convince-developers-and-management-to-use-automated-unit-test-for-ajax-websites.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/ideas/default.aspx">ideas</category><category domain="http://msmvps.com/blogs/omar/archive/tags/misc/default.aspx">misc</category><category domain="http://msmvps.com/blogs/omar/archive/tags/ajax/default.aspx">ajax</category><category domain="http://msmvps.com/blogs/omar/archive/tags/unit+test/default.aspx">unit test</category><description>Everyone agrees that unit testing is a good thing, we should all write unit tests. We read articles and blogs to keep us up-to-date on what’s going on in the unit test world so that we can sound cool talking to peers at lunch. But when we really sit down and try to write unit tests ourselves – “Naaah, this is waste of time, let’s ask my QA to test it; that’s much more reliable and guaranteed way to test this. What’s the point testing these functions when there are so many other functions that we should unit test first?” Had such moment yourself or with someone else? Read on.  
I had a conversation with our development lead Mike (using a highly generic name since my last post caused some trouble), who runs “the show” in our engineering team. As usual there was reservation in introducing unit test to regular development schedule. Mike also had valid points about lack of powerful tools for doing unit test on AJAX websites. He also had confusion on ‘what’ and ‘how’ to unit test our code so that we aren’t just testing database failures but real user actions that executes both business and rendering logics. So, the discussion has a lot of useful information, that will help you take the right decision when you want to sell unit test to your ASP.NET and/or AJAX development team and finally to higher management so that you can buy enough time for the effort.  
Friday, Jan 2007 – hallway      
Omar: Hey Mike, we need to start doing unit testing at least on our web services. We are wasting way too much time on manual QA. Since we are an AJAX shop, unit testing all our web services should give us pretty well coverage.   
Mike: Sure, that sounds fun. I will do some feasibility check and see how can we chip this in into our next sprint.  
Friday, Feb 2007 – washroom&amp;#160; 
Omar: Hey Mike, let’s start doing unit tests. I haven’t seen any tests last month. Can we start from this sprint?  
Mike: Sure, we can surely start from this sprint. Let me find out which tool is the right one for us.  
Friday, March 2007 – meeting room     
Omar: Hey Mike, haven’t seen any unit tests in the solution so far. Let’s seriously start writing unit tests. Did you make any plan how you want to start unit testing the webservices?  
Mike: Yeah, I did some digging around and found some tools. But most of them are for non-AJAX sites where you can programmatically hit a URL or programmatically do HTTP POST on a URL. You can also record button clicks and form posts from the browser. There’s Visual Studio’s Web Test, which does pretty good job recording regular ASP.NET site, but poor on AJAX sites. Moreover, you need to buy Team Suite edition to get that Web Test feature. Besides, recording tests and playing them back really does not help us because all those tests contain hard coded data. We can’t repeat a particular step many times with random data, at least not using any off-the-shelf tools. We need to test things carefully and systematically using random data set and sometimes use...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=fvJttJrO18w:kiUnSE-1Xxg:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=fvJttJrO18w:kiUnSE-1Xxg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=fvJttJrO18w:kiUnSE-1Xxg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=fvJttJrO18w:kiUnSE-1Xxg:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/fvJttJrO18w" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/27/how-to-convince-developers-and-management-to-use-automated-unit-test-for-ajax-websites.aspx</feedburner:origLink></item><item><title>Solving common problems with Compiled Queries in Linq to Sql for high demand ASP.NET websites</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/Nc-bH9JpSO0/solving-common-problems-with-compiled-queries-in-linq-to-sql-for-high-demand-asp-net-websites.aspx</link><pubDate>Mon, 27 Oct 2008 13:31:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1652150</guid><dc:creator>omar</dc:creator><slash:comments>14</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1652150</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/27/solving-common-problems-with-compiled-queries-in-linq-to-sql-for-high-demand-asp-net-websites.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/linq/default.aspx">linq</category><category domain="http://msmvps.com/blogs/omar/archive/tags/.net/default.aspx">.net</category><description>If you are using Linq to SQL, instead of writing regular Linq Queries, you should be using Compiled Queries. if you are building an ASP.NET web application that&amp;rsquo;s going to get thousands of hits per hour, the execution overhead of Linq queries is going to consume too much CPU and make your site slow. There&amp;rsquo;s a runtime cost associated with each and every Linq Query you write. The queries are parsed and converted to a nice SQL Statement on *every* hit. It&amp;rsquo;s not done at compile time because there&amp;rsquo;s no way to figure out what you might be sending as the parameters in the queries during runtime. So, if you have common Linq to Sql statements like the following one throughout your growing web application, you are soon going to have scalability nightmares:

var query = from widget in dc.Widgets
                where widget.ID == id &amp;amp;&amp;amp; widget.PageID == pageId
                select widget;

var widget = query.SingleOrDefault();


There&amp;rsquo;s a nice blog post by JD Conley that shows how evil Linq to Sql queries are:



You see how many times SqlVisitor.Visit is called to convert a Linq Query to its SQL representation? The runtime cost to convert a Linq query to its SQL Command representation is just way too high.

Rico Mariani has a very informative performance comparison of regular Linq queries vs Compiled Linq queries performance:



Compiled Query wins on every case.

So, now you know about the benefits of compiled queries. If you are building ASP.NET web application that is going to get high traffic and you have a lot of Linq to Sql queries throughout your project, you have to go for compiled queries. Compiled Queries are built for this specific scenario. 

In this article, I will show you some steps to convert regular Linq to Sql queries to their Compiled representation and how to avoid the dreaded exception &amp;ldquo;Compiled queries across DataContexts with different LoadOptions not supported.&amp;rdquo;

Here are some step by step instruction on converting a Linq to Sql query to its compiled form:

First we need to find out all the external decision factors in a query. It mostly means parameters in the WHERE clause. Say, we are trying to get a user from aspnet_users table using Username and Application ID:
 

Here, we have two external decision factor &amp;ndash; one is the Username and another is the Application ID. So, first think this way, if you were to wrap this query in a function that will just return this query as it is, what would you do? You would create a function that takes the DataContext (dc named here), then two parameters named userName and applicationID, right?

So, be it. We create one function that returns just this query:



Next step is to replace this function with a Func&amp;lt;&amp;gt; representation that returns the query. This is the hard part. If you haven&amp;rsquo;t dealt with Func&amp;lt;&amp;gt; and Lambda expression before, then I suggest you read this and this and then continue.

So, here&amp;rsquo;s the delegate...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Nc-bH9JpSO0:QPjYis-Ap2U:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Nc-bH9JpSO0:QPjYis-Ap2U:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Nc-bH9JpSO0:QPjYis-Ap2U:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Nc-bH9JpSO0:QPjYis-Ap2U:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/Nc-bH9JpSO0" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/27/solving-common-problems-with-compiled-queries-in-linq-to-sql-for-high-demand-asp-net-websites.aspx</feedburner:origLink></item><item><title>Tips and tricks to rescue overdue projects</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/vBOI7L_fwcw/tips-and-tricks-to-rescue-overdue-projects.aspx</link><pubDate>Mon, 20 Oct 2008 18:08:34 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1651416</guid><dc:creator>omar</dc:creator><slash:comments>15</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1651416</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/20/tips-and-tricks-to-rescue-overdue-projects.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/ideas/default.aspx">ideas</category><category domain="http://msmvps.com/blogs/omar/archive/tags/misc/default.aspx">misc</category><description>One of my friends, who runs his own offshore development shop, was having nightmare situation with one of his customers. He&amp;#39;s way overdue on a release, the customer is screaming everyday, he&amp;#39;s paying his team from his own pocket, customer is sending an ever increasing list of changes and so on. Here&amp;#39;s how we discussed some ideas to get out of such a situation and make sure it does not repeat in future:   
Kabir: Hey, can you help me? My customer is making us work for free for extra two months to fix bugs from our last delivery. We did what he said. But after he saw the output, he came up with hundred changes, which he somehow presents as bugs or missing features and make them look like they are all our fault and making us work for last two months for free. He is sending new changes every week. We have no idea when we will complete the iteration.   
Omar: I see. Did you get a signed list of requirements from customer before you started the development?   
Kabir: Of course, I did. He sent us a word document explaining what he wants and we sent him a task breakup with hour estimates and total duration of three months. Now after three months when we showed him the product, he said, it&amp;#39;s no where close to what he had expected. Then he sent a gigantic list of things to change.   
Omar: All of those are bugs?   
Kabir: Of course not. Most of them are new features.   
Omar: Then why don&amp;#39;t you say those are new features? You have the original word document to prove. Just ask him to show where in the word document did he said X needs to be done?   
Kabir: Well..., he&amp;#39;s tricky. He somehow makes things look like it is obvious that X needs to be done and he&amp;#39;s not going to accept a requirement as done until X is done. For example, he said there must be a complete login form in the homepage. So, we did a typical login form with user name, password and OK, Cancel button. Now he says where&amp;#39;s the email verification thing? We said, you did not ask for it. He said, &amp;quot;this is obvious, every login form has a forgot password and email verification; I said *complete* login form, not half-baked login form&amp;quot;. So, you see, we can&amp;#39;t really argue to keep our image. Then, we did the login form exactly how he said. Now he says, where the client side validations of proper email address, username length, password confirmation? We said, you never asked for it! He says, &amp;quot;come on, every single website nowadays has AJAX enabled client side validation, do I have to tell you every single thing? Aren&amp;#39;t you guys smart enough to figure this out? You are already doing this for the third time, can&amp;#39;t you do it really well this time?&amp;quot;   
Omar: OK, stop. I see what&amp;#39;s your problem. Some customer will always try to make you work more for less money. They will try to squeeze out every bit of development they can for their bucks. So, you have to be extra careful on how much you commit to them and make sure they cannot chip in more...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=vBOI7L_fwcw:4pKN0lLk8FM:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=vBOI7L_fwcw:4pKN0lLk8FM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=vBOI7L_fwcw:4pKN0lLk8FM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=vBOI7L_fwcw:4pKN0lLk8FM:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/vBOI7L_fwcw" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/20/tips-and-tricks-to-rescue-overdue-projects.aspx</feedburner:origLink></item><item><title>An Agile Developer's workflow when SCRUM is used</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/Fb5wVsfQIf4/an-agile-developer-s-workflow-when-scrum-is-used.aspx</link><pubDate>Sat, 11 Oct 2008 07:21:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650562</guid><dc:creator>omar</dc:creator><slash:comments>5</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1650562</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/11/an-agile-developer-s-workflow-when-scrum-is-used.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/ideas/default.aspx">ideas</category><category domain="http://msmvps.com/blogs/omar/archive/tags/misc/default.aspx">misc</category><description>If you are planning to start SCRUM at your company, you might need to train developers and QA to get into the mindset of an Agile developer. SCRUM is only successful when the developers and QA get into the habit of following the principles of SCRUM by heart. So, sometimes you need to offer training or do trial sprints to give some room to your developers how to get used to the working fashion of SCRUM. Giving them a handy workflow diagram that shows how they should work helps soothe the steep learning curve required for non-super star developers. I made such a workflow while I was teaching SCRUM at my friend&amp;#39;s company. The following diagram was printed and hung over the desk of each and every developer to help them grasp the culture of SCRUM quickly:



We use Flyspray for issue tracking, so you will see the mention of it frequently. 

You will see the step to &amp;quot;Update Sprint backlog with remaining hours&amp;quot; is missing. This is done kinda verbally and scrum master (sometimes same person who is the product owner) keeps track of it.

Hope you find this useful.


&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Fb5wVsfQIf4:nPzXbpWOXEA:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Fb5wVsfQIf4:nPzXbpWOXEA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=Fb5wVsfQIf4:nPzXbpWOXEA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=Fb5wVsfQIf4:nPzXbpWOXEA:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/Fb5wVsfQIf4" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/11/an-agile-developer-s-workflow-when-scrum-is-used.aspx</feedburner:origLink></item><item><title>ASP.NET website Continuous Integration+Deployment using CruiseControl.NET, Subversion, MSBuild and Robocopy</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/gcjuL_ndnOA/asp-net-website-continuous-integration-deployment-using-cruisecontrol-net-subversion-msbuild-and-robocopy.aspx</link><pubDate>Mon, 06 Oct 2008 06:59:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1649873</guid><dc:creator>omar</dc:creator><slash:comments>15</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1649873</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/06/asp-net-website-continuous-integration-deployment-using-cruisecontrol-net-subversion-msbuild-and-robocopy.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/misc/default.aspx">misc</category><category domain="http://msmvps.com/blogs/omar/archive/tags/production/default.aspx">production</category><description>You can setup continuous integration and automated deployment for your web application using CruiseControl.NET, Subversion, MSBuild and Robocopy. I will show you how you can automatically build the entire solution, email build report to developers and QA, deploy latest code in IIS all using CruiseControl.NET every N minutes. 

First get the following:

CruiseControl.NET  
Subversion (install the command line tools and add the Subversion bin path to PATH environment variable)  
Robocopy (Windows Vista/2008 has it built-in, here&amp;#39;s the link for Windows 2003)  
Install .NET Framework. You need it for MSBuild. 


You will learn how I have configured Continuous Integration and Deployment for my open source AJAX Portal project www.Dropthings.com. The code is hosted at CodePlex. When some developer makes a commit, CruiseControl downloads the latest code, builds the entire solution, emails build report and then deploys the latest web site to IIS 6.0.

After installing CruiseControl.NET, go to Programs -&amp;gt; Cruise Control -&amp;gt; CruiseControl.NET Config.

Now keep copying and pasting the following XML blocks and make sure you understand each block and make necessary changes:


   1: &amp;lt;cruisecontrol&amp;gt;
   2:     &amp;lt;project name=&amp;quot;Dropthings&amp;quot; queue=&amp;quot;DropthingsQueue&amp;quot; queuePriority=&amp;quot;1&amp;quot;&amp;gt;
   3:         &amp;lt;!-- 
   4:         Path to the trunk folder where the full solution starts from. This is where
   5:         subversion checkout and incremental update is performed 
   6:         --&amp;gt;
   7:         &amp;lt;workingDirectory&amp;gt;d:\cc\dropthings\code\trunk\&amp;lt;/workingDirectory&amp;gt;
   8:         &amp;lt;!-- Some path where CCNet writes its logs and stuffs. It can be outside the log folder --&amp;gt;
   9:         &amp;lt;artifactDirectory&amp;gt;d:\cc\dropthings\artifact\&amp;lt;/artifactDirectory&amp;gt;
  10:         &amp;lt;category&amp;gt;Dropthings&amp;lt;/category&amp;gt;
  11:         &amp;lt;!-- CCNet installs a web dashboard. Enter the URL of that dashboard here --&amp;gt;
  12:         &amp;lt;webURL&amp;gt;http://localhost/ccnet/&amp;lt;/webURL&amp;gt;
  13:         &amp;lt;modificationDelaySeconds&amp;gt;60&amp;lt;/modificationDelaySeconds&amp;gt;
  14:         &amp;lt;labeller type=&amp;quot;defaultlabeller&amp;quot;&amp;gt;
  15:             &amp;lt;prefix&amp;gt;0.1.&amp;lt;/prefix&amp;gt;
  16:             &amp;lt;incrementOnFailure&amp;gt;true&amp;lt;/incrementOnFailure&amp;gt;
  17:             &amp;lt;labelFormat&amp;gt;000&amp;lt;/labelFormat&amp;gt;
  18:         &amp;lt;/labeller&amp;gt;
  19:         &amp;lt;state type=&amp;quot;state&amp;quot; directory=&amp;quot;State&amp;quot; /&amp;gt;



First change the working directory. It needs to be the path of the folder where you will have the solution downloaded. I generally create folder structure like this:

D:\CC - Root for all CC.NET enabled projects 

\ProjectName - Root project folder 

\Code - Code folder where code is downloaded from subversion 

\Artifact - CC.NET generates a lot of stuff. All goes here.






 Next comes the Subversion integration block:


   1: &amp;lt;sourcecontrol type=&amp;quot;svn&amp;quot;&amp;gt;
   2:    ...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=gcjuL_ndnOA:0FVtpVe4JaA:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=gcjuL_ndnOA:0FVtpVe4JaA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=gcjuL_ndnOA:0FVtpVe4JaA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=gcjuL_ndnOA:0FVtpVe4JaA:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/gcjuL_ndnOA" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/06/asp-net-website-continuous-integration-deployment-using-cruisecontrol-net-subversion-msbuild-and-robocopy.aspx</feedburner:origLink></item><item><title>Using multiple broadband connections without using any special router or software</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/kwIvli9E3gg/using-multiple-broadband-connections-without-using-any-special-router-or-software.aspx</link><pubDate>Sun, 05 Oct 2008 10:29:18 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1649771</guid><dc:creator>omar</dc:creator><slash:comments>7</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1649771</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/05/using-multiple-broadband-connections-without-using-any-special-router-or-software.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/ideas/default.aspx">ideas</category><category domain="http://msmvps.com/blogs/omar/archive/tags/misc/default.aspx">misc</category><description>I have two broadband connections. One cheap connection, which I mostly use for browsing and downloading. Another very expensive connection that I use for voice chat, remote desktop connection etc. Now, using these two connections at the same time required two computers before. But I figured out a way to use both connections at the same time using the same computer. Here&amp;#39;s how: 
Connect the cheap internet connection that is used mostly for non-critical purpose like downloading, browsing to a wireless router. 
Connect the expensive connection that is used for network latency sensitive work like Voice Conference, Remote Desktop directly via LAN. 
When you want to establish a critical connection like starting voice conf app (Skype) or remote desktop client, momentarily disconnect the wireless. This will make your LAN connection the only available internet. So, all the new connections will be established over the LAN. Now you can start Skype and initiate a voice conference or use Remote Desktop client and connect to a computer. The connection will be established over LAN. 
Now turn on wireless. Wireless will now become the first preference for Windows to go to internet. So, now you can start Outlook, browser etc and they will be using the wireless internet connection. During this time, Skype and Terminal Client is still connected over the LAN connection. As they use persisted connection, they keep using the LAN connection and do not switch to the wireless.  
This way you get to use two broadband connections simultaneously. 
&amp;nbsp;  
Here you see I have data transfer going on through two different connection. The bottom one is the LAN which is maintaining a continuous voice data stream. The upper one is the wireless connection that sometimes consumes bandwidth when I browse. 
  
Using Sysinternal&amp;#39;s TCPView, I can see some connection is going through LAN and some through Belkin router. The selected ones - the terminal client and the MSN Messenger is using LAN where the Internet Explorer and Outlook is working over Wireless connection. &lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=kwIvli9E3gg:4yFKK3Xe42I:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=kwIvli9E3gg:4yFKK3Xe42I:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=kwIvli9E3gg:4yFKK3Xe42I:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=kwIvli9E3gg:4yFKK3Xe42I:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/kwIvli9E3gg" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/05/using-multiple-broadband-connections-without-using-any-special-router-or-software.aspx</feedburner:origLink></item><item><title>Best practices for creating websites in IIS 6.0</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/UFBs-Pp0Pp8/best-practices-for-creating-websites-in-iis-6-0.aspx</link><pubDate>Sat, 04 Oct 2008 10:05:22 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1649697</guid><dc:creator>omar</dc:creator><slash:comments>19</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1649697</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/04/best-practices-for-creating-websites-in-iis-6-0.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/production/default.aspx">production</category><category domain="http://msmvps.com/blogs/omar/archive/tags/IIS/default.aspx">IIS</category><description>Every time I create an IIS website, I do some steps, which I consider as best practice for creating any IIS website for better performance, maintainability, and scalability. Here&amp;#39; re the things I do: 
Create a separate application pool for each web application 
I always create separate app pool for each web app because I can select different schedule for app pool recycle. Some heavy traffic websites have long recycle schedule where low traffic websites have short recycle schedule to save memory. Moreover, I can choose different number of processes served by the app pool. Applications that are made for web garden mode can benefit from multiple process where applications that use in-process session, in memory cache needs to have single process serving the app pool. Hosting all my application under the DefaultAppPool does not give me the flexibility to control these per site. 
The more app pool you create, the more ASP.NET threads you make available to your application. Each w3wp.exe has it&amp;#39;s own thread pool. So, if some application is congesting particular w3wp.exe process, other applications can run happily on their separate w3wp.exe instance, running under separate app pool. Each app pool hosts its own w3wp.exe instance. 
So, my rule of thumb: Always create new app pool for new web applications and name the app pool based on the site&amp;#39;s domain name or some internal name that makes sense. For example, if you are creating a new website alzabir.com, name the app pool alzabir.com to easily identify it. 
Another best practice: Disable the DefaultAppPool so that you don&amp;#39;t mistakenly keep adding sites to DefaultAppPool. 
  
First you create a new application pool. Then you create a new Website or Virtual Directory, go to Properties -&amp;gt; Home Directory tab -&amp;gt; Select the new app pool. 
 
Customize Website properties for performance, scalability and maintainability 
First you map the right host headers to your website. In order to do this, go to WebSite tab and click on &amp;quot;Advanced&amp;quot; button. Add mapping for both domain.com and www.domain.com. Most of the time, people forget to map the domain.com. Thus many visitors skip typing the www prefix and get no page served. 
 
Next turn on some log entries: 
 
These are very handy for analysis. If you want to measure your bandwidth consumption for specific sites, you need the Bytes Sent. If you want to measure the execution time of different pages and find out the slow running pages, you need Time Taken. If you want to measure unique and returning visitors, you need the Cookie. If you need to know who is sending you most traffic - search engines or some websites, you need the Referer. Once these entries are turned on, you can use variety of Log Analysis tools to do the analysis. For example, open source AWStats.  
But if you are using Google Analytics or something else, you should have these turned off, especially the Cookie and Referer because they take quite some space on the log. If...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=UFBs-Pp0Pp8:Rfar1v6i7ho:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=UFBs-Pp0Pp8:Rfar1v6i7ho:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=UFBs-Pp0Pp8:Rfar1v6i7ho:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=UFBs-Pp0Pp8:Rfar1v6i7ho:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/UFBs-Pp0Pp8" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/04/best-practices-for-creating-websites-in-iis-6-0.aspx</feedburner:origLink></item><item><title>Create ASP.NET MVC Controllers under Namespace and specific URL</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/x8AlDh3RxXY/create-asp-net-mvc-controllers-under-namespace-and-specific-url.aspx</link><pubDate>Sat, 04 Oct 2008 08:06:21 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1649692</guid><dc:creator>omar</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1649692</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/04/create-asp-net-mvc-controllers-under-namespace-and-specific-url.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/MVC/default.aspx">MVC</category><description>When you have a lot of controllers, you need to organize them under Namespaces. Also, it is better to put controllers under subfolders in order to organize them properly and have some meaningful URL for them like /Admin/User where Admin is the subfolder and User is the controller. For example, you might have a lot of controllers that are APIs exposed by your web app, not regular pages. So, you might want to put them under /API/ folder. You also want to make sure no one can access those controllers from the root url. For example, no one must call /User/GetUserList instead they must call /API/User/GetUserList 
ASP.NET MVC default routing and Controller Factory is very greedy, it ignores the subfolders inside the &amp;quot;Controllers&amp;quot; folder. There&amp;#39;s a DefaultControllerFactory class in ASP.NET MVC which traverses all controllers under the &amp;quot;Controller&amp;quot; folder and creates a cache using just the class name as the key. So, it ignores any namespace or any subfolder where you have put the controller. So, I created a derivative of the default controller factory and created a new factory that checks if the requested controller belongs to any specific namespace and whether that controller must be inside a specific subfolder. You can map /Admin folder to respond to all controllers that are under then YourWebApp.Admin namespace. Similarly, you can map /API folder to respond to all controllers that are under the YourWebApp.API namespace. None of these controllers can be accessed outside the specified URL. Here&amp;#39;s the factory that does it: 
 
This controller checks the namespace of the controller being returned by ASP.NET MVC&amp;#39;s default implementation and ensures the requested URL is the right url where controllers from the namespace can be accessed. So, this means if the controller matches MvcWebAPI.API.UserController, it ensures the URL being requested must be /MvcWebAPI/API/User. It will return null if the URL was something else like /MvcWebAPI/User or /MvcWebAPI/SomeotherFolder/User. 
Here&amp;#39;s how you use it form Global.asax: 
  
You create a mapping for a Namespace and the subfolder it must belong to. Then you register the new Controller Factory as the default controller factory. 
Now the second catch is, the default Route for the {controller}/{action}/{id} won&amp;#39;t work for you. You need to create a specific router that starts with the subfolder name. For example, API/{controller}/{action} 
  
Here&amp;#39; two things to notice:  The use of PathStartWith routing constraint, which I will explain soon  The last parameter which tells the route to include the API namespace for this route. Otherwise it can&amp;#39;t find the controllers in the API namespace 
So, the PathStartsWith routing constraint ensures this route gets hit only when the requested URL is under the /API/ folder. For any other URL, it returns false and thus the routing handler skips this route. 
  
It just does a comparison on the AbsolutePath of the current request URL to...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=x8AlDh3RxXY:zjEuKozKamc:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=x8AlDh3RxXY:zjEuKozKamc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=x8AlDh3RxXY:zjEuKozKamc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=x8AlDh3RxXY:zjEuKozKamc:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/x8AlDh3RxXY" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/04/create-asp-net-mvc-controllers-under-namespace-and-specific-url.aspx</feedburner:origLink></item><item><title>Create REST API using ASP.NET MVC that speaks both Json and plain Xml</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/n0CtjdX0MpY/create-rest-api-using-asp-net-mvc-that-speaks-both-json-and-plain-xml.aspx</link><pubDate>Fri, 03 Oct 2008 16:05:51 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1649607</guid><dc:creator>omar</dc:creator><slash:comments>15</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1649607</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/10/03/create-rest-api-using-asp-net-mvc-that-speaks-both-json-and-plain-xml.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://msmvps.com/blogs/omar/archive/tags/ajax/default.aspx">ajax</category><category domain="http://msmvps.com/blogs/omar/archive/tags/MVC/default.aspx">MVC</category><description>ASP.NET MVC Controllers can directly return objects and collections, without rendering a view, which makes it quite appealing for creating REST like API. The nice extensionless Url provided by MVC makes it handy to build REST services, which means you can create APIs with smart Url like &amp;quot;something.com/API/User/GetUserList&amp;quot; 
There are some challenges to solve in order to expose REST API:  Based on who is calling your API, you need to be able to speak both Json and plain old Xml (POX). If the call comes from an AJAX front-end, you need to return objects serialized as Json. If it&amp;#39;s coming from some other client, say a PHP website, you need to return plain Xml.  Similarly you need to be able to understand REST, Json and plain Xml calls. Someone can hit you using REST url, someone can post a Json payload or someone can post Xml payload. 
I have created an ObjectResult class which takes an object and generates Xml or Json output automatically looking at the Content-Type header of HttpRequest. AJAX calls send Content-Type=application/json. So, it generates Json as response in that case, but when Content-Type is something else, it does simple Xml Serialzation.  
 
Here&amp;#39;s the ObjectResult that you can use from Controllers to return objects and it takes care of proper serialization method. Above shows the Json serialization, which is quite simple. XmlSerialization is a bit complex though: 
 Things to note here:  You have to force UTF8 encoding. Otherwise it produces UTF16 output.  XML Declaration is skipped because that&amp;#39;s not quite necessary. Wastes bandwidth. If you need it, turn it on.  I have turned on indenting for better readability. You can turn it off to save bandwidth. 
Some of you might be boiling inside looking at my obscure coding style. I love this style! I am spoiled by jQuery. I wish there was a cQuery. I actually started writing one, but it never saw day light just like my hundred other open source attempts. 
Now back to Object Serialization, we got the serialization done. Now you can return objects from Controller easily: 
  
You can use the test web project to call these methods and see the result: 
  
So far you have seen simple object and list serialization. A best practice is to return a common result object that has some status, message and then the real payload. It&amp;#39;s handy when you only need to return some error but no object or list. I use a common Result object that has three properties - ErrorCode (0 by default means success), Message (a string data type) and Data which is the real object. 
  
When you want to return only a result with error message, you can do this: 
  
This produces a result like this: 
  
No payload here. So, the return format is always consistent. Those who are consuming service can write a common Xml or Json parsing code to consume both success and failure response. Those who are building API for their website, I humbly request you to return consistent response for both success and...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=n0CtjdX0MpY:Bl6iaCPqcq4:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=n0CtjdX0MpY:Bl6iaCPqcq4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=n0CtjdX0MpY:Bl6iaCPqcq4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=n0CtjdX0MpY:Bl6iaCPqcq4:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/n0CtjdX0MpY" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/10/03/create-rest-api-using-asp-net-mvc-that-speaks-both-json-and-plain-xml.aspx</feedburner:origLink></item><item><title>HTTP handler to combine multiple files, cache and deliver compressed output for faster page load</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/tv_cnv3oCV0/http-handler-to-combine-multiple-files-cache-and-deliver-compressed-output-for-faster-page-load.aspx</link><pubDate>Thu, 28 Aug 2008 18:43:45 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646119</guid><dc:creator>omar</dc:creator><slash:comments>25</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1646119</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/08/28/http-handler-to-combine-multiple-files-cache-and-deliver-compressed-output-for-faster-page-load.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><description>It&amp;#39;s a good practice to use many small Javascript and CSS files instead of one large Javascript/CSS file for better code maintainability, but bad in terms of website performance. Although you should write your Javascript code in small files and break large CSS files into small chunks but when browser requests those javascript and css files, it makes one Http request per file. Every Http Request results in a network roundtrip form your browser to the server and the delay in reaching the server and coming back to the browser is called latency. So, if you have four javascripts and three css files loaded by a page, you are wasting time in seven network roundtrips. Within USA, latency is average 70ms. So, you waste 7x70 = 490ms, about half a second of delay. Outside USA, average latency is around 200ms. So, that means 1400ms of waiting. Browser cannot show the page properly until Css and Javascripts are fully loaded. So, the more latency you have, the slower page loads. 
Here&amp;#39;s a graph that shows how each request latency adds up and introduces significant delay in page loading: 
  
You can reduce the wait time by using a CDN. Read my previous blog post about using CDN. However, a better solution is to deliver multiple files over one request using an HttpHandler that combines several files and delivers as one output. So, instead of putting many &amp;lt;script&amp;gt; or &amp;lt;link&amp;gt; tag, you just put one &amp;lt;script&amp;gt; and one &amp;lt;link&amp;gt; tag, and point them to the HttpHandler. You tell the handler which files to combine and it delivers those files in one response. This saves browser from making many requests and eliminates the latency.  
  
Here you can see how much improvement you get if you can combine multiple javascripts and css into one. 
In a typical web page, you will see many javascripts referenced:&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/Content/JScript/jquery.js&amp;quot;&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/Content/JScript/jDate.js&amp;quot;&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/Content/JScript/jQuery.Core.js&amp;quot;&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/Content/JScript/jQuery.Delegate.js&amp;quot;&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/Content/JScript/jQuery.Validation.js&amp;quot;&amp;gt;
&amp;lt;/script&amp;gt;

Instead of these individual &amp;lt;script&amp;gt; tags, you can use only one &amp;lt;script&amp;gt; tag to serve the whole set of scripts using an Http Handler:&amp;lt;script type=&amp;quot;text/javascript&amp;quot; 
    src=&amp;quot;HttpCombiner.ashx?s=jQueryScripts&amp;amp;t=text/javascript&amp;amp;v=1&amp;quot; &amp;gt;
&amp;lt;/script&amp;gt; 

The Http Handler reads the file names defined in a configuration and combines all those files and delivers as one response. It delivers the response as gzip compressed to save bandwidth. Moreover, it generates proper cache header to cache the response in browser cache, so that, browser does not request it...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=tv_cnv3oCV0:S-Eph0b0y58:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=tv_cnv3oCV0:S-Eph0b0y58:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=tv_cnv3oCV0:S-Eph0b0y58:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=tv_cnv3oCV0:S-Eph0b0y58:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/tv_cnv3oCV0" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/08/28/http-handler-to-combine-multiple-files-cache-and-deliver-compressed-output-for-faster-page-load.aspx</feedburner:origLink></item><item><title>Loading static content in ASP.NET pages from different domain for faster parallel download</title><link>http://feedproxy.google.com/~r/OmarAlZabirBlog/~3/9ge7sjX9TnU/loading-static-content-in-asp-net-pages-from-different-domain-for-faster-parallel-download.aspx</link><pubDate>Fri, 01 Aug 2008 18:15:08 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1643008</guid><dc:creator>omar</dc:creator><slash:comments>25</slash:comments><wfw:commentRss>http://msmvps.com/blogs/omar/rsscomments.aspx?PostID=1643008</wfw:commentRss><comments>http://msmvps.com/blogs/omar/archive/2008/08/01/loading-static-content-in-asp-net-pages-from-different-domain-for-faster-parallel-download.aspx#comments</comments><category domain="http://msmvps.com/blogs/omar/archive/tags/performance/default.aspx">performance</category><category domain="http://msmvps.com/blogs/omar/archive/tags/asp.net/default.aspx">asp.net</category><description>Generally we put static content (images, css, js) of our website inside the same web project. Thus they get downloaded from the same domain like www.dropthings.com. There are three problems in this approach:  They occupy connections on the same domain www.dropthings.com and thus other important calls like Web service call do not get a chance to happen earlier as browser can only make two simultaneous connections per domain.  If you are using ASP.NET Forms Authentication, then you have that gigantic Forms Authentication cookie being sent with every single request on www.dropthings.com. This cookie gets sent for all images, CSS and JS files, which has no use for the cookie. Thus it wastes upload bandwidth and makes every request slower. Upload bandwidth is very limited for users compared to download bandwidth. Generally users with 1Mbps download speed has around 128kbps upload speed. So, adding another 100 bytes on the request for the unnecessary cookie results in delay in sending the request and thus increases your site load time and the site feels slow to respond.  It creates enormous IIS Logs as it records the cookies for each static content request. Moreover, if you are using Google Analytics to track hits to your site, it issues four big cookies that gets sent for each and every image, css and js files resulting in slower requests and even larger IIS log entries. 
Let&amp;#39;s see the first problem, browser&amp;#39;s two connection limit. See what happens when content download using two HTTP requests in parallel: 
 
This figure shows only two files are downloaded in parallel. All the hits are going to the same domain e.g. www.dropthings.com. As you see, only two call can execute at the same time. Moreover, due to browser&amp;#39;s way of handling script tags, once a script is being downloaded, browser does not download anything else until the script has downloaded and executed. 
Now, if we can download the images from different domain, which allows browser to open another two simultaneous connections, then the page loads a lot faster: 
 
You see, the total page downloads 40% faster. Here only the images are downloaded from a different domain e.g. &amp;quot;s.dropthings.com&amp;quot;, thus the calls for the script, CSS and webservices still go to main domain e.g. www.dropthings.com 
The second problem for loading static content from same domain is the gigantic forms authentication cookie or any other cookie being registered on the main domain e.g. www subdomain. Here&amp;#39;s how Pageflake&amp;#39;s website&amp;#39;s request looks like with the forms authentication cookie and Google Analytics cookies: 
  
You see a lot of data being sent on the request header which has no use for any static content. Thus it wastes bandwidth, makes request reach server slower and produces large IIS logs. 
You can solve this problem by loading static contents from different domain as we have done it at Pageflakes by loading static contents from a different domain e.g. flakepage.com. As the...&lt;br/&gt;
&lt;br/&gt;
Visit my Blog for more details.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=9ge7sjX9TnU:xXFnXhHlJ3o:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=9ge7sjX9TnU:xXFnXhHlJ3o:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?i=9ge7sjX9TnU:xXFnXhHlJ3o:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?a=9ge7sjX9TnU:xXFnXhHlJ3o:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OmarAlZabirBlog?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OmarAlZabirBlog/~4/9ge7sjX9TnU" height="1" width="1"/&gt;</description><feedburner:origLink>http://msmvps.com/blogs/omar/archive/2008/08/01/loading-static-content-in-asp-net-pages-from-different-domain-for-faster-parallel-download.aspx</feedburner:origLink></item></channel></rss>
