<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tanzim Saqib on .NET discovery &#187; C#</title>
	<atom:link href="http://tanzimsaqib.wordpress.com/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://tanzimsaqib.wordpress.com</link>
	<description>Innovate. Create. Share.</description>
	<lastBuildDate>Wed, 19 Nov 2008 10:04:28 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='tanzimsaqib.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/756ba5f132c23525771f86885e65d27c?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Tanzim Saqib on .NET discovery &#187; C#</title>
		<link>http://tanzimsaqib.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://tanzimsaqib.wordpress.com/osd.xml" title="Tanzim Saqib on .NET discovery" />
		<item>
		<title>Simple Form Validation &#8211; A Reflection based approach</title>
		<link>http://tanzimsaqib.wordpress.com/2008/03/28/simple-form-validation-a-reflection-based-approach-2/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/03/28/simple-form-validation-a-reflection-based-approach-2/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 17:02:24 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/03/28/simple-form-validation-a-reflection-based-approach-2/</guid>
		<description><![CDATA[Are you tired of placing multiple Validation controls on Form? If you are bored of following scenario like me, keep on reading the post:
 
A simple Email address validation can consist of whether

The field is empty
Longer than limit
Email address format is invalid
Already in use

Ordinary solution to this problem is placing multiple validation controls for a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=70&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Are you tired of placing multiple Validation controls on Form? If you are bored of following scenario like me, keep on reading the post:</p>
<p><a href="http://tanzimsaqib.files.wordpress.com/2008/03/validators.png"><img style="border-width:0;" height="82" alt="Validators" src="http://tanzimsaqib.files.wordpress.com/2008/03/validators-thumb.png?w=365&#038;h=82" width="365" border="0"></a> </p>
<p>A simple Email address validation can consist of whether</p>
<ul>
<li>The field is empty
<li>Longer than limit
<li>Email address format is invalid
<li>Already in use</li>
</ul>
<p>Ordinary solution to this problem is placing multiple validation controls for a single TextBox. You can simply it by replacing all with a single Custom Validator. Our goal is to reduce amount of controls on the form to keep it simple. To do that, we would have to write code for Custom Validator that does it all. We also would like to write minimum code to validate the control without compromising manageability. Let us assume we would write the following code inside the ServerValidate of that control:</p>
<pre><span style="color:blue;">protected void </span>cvEmailAddress_ServerValidate(<span style="color:blue;">object </span>source, <span style="color:#2b91af;">ServerValidateEventArgs </span>args)
{
    <span style="color:#2b91af;">ValidationController</span>.ValidateControl&lt;<span style="color:#2b91af;">ProfileValidator</span>&gt;(cvEmailAddress, <span style="color:#2b91af;">ProfileValidator</span>.<span style="color:#2b91af;">Fields</span>.EmailAddress.ToString(), args);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Let us declare a ValidationErrorResult object that contains error messages and text to display in the UI:</p>
<pre><span style="color:blue;">public sealed class </span><span style="color:#2b91af;">ValidationErrorResult
</span>{
    <span style="color:blue;">public string </span>ErrorMessage { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }
    <span style="color:blue;">public string </span>Text { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>And an Attribute which would be used to tag a specific method which would be responsible for validation of particular control:</p>
<pre>[<span style="color:#2b91af;">AttributeUsage</span>(<span style="color:#2b91af;">AttributeTargets</span>.Method, Inherited = <span style="color:blue;">false</span>, AllowMultiple = <span style="color:blue;">true</span>)]
<span style="color:blue;">public sealed class </span><span style="color:#2b91af;">ValidationMethodAttribute </span>: <span style="color:#2b91af;">Attribute
</span>{
    <span style="color:blue;">public </span>ValidationMethodAttribute(<span style="color:blue;">string </span>fieldName)
    {
        <span style="color:blue;">this</span>.FieldName = fieldName;
    }

    <span style="color:blue;">public string </span>FieldName { <span style="color:blue;">get</span>; <span style="color:blue;">private set</span>; }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>If you are already familiar with Attirbute based programming, I hope you know the attribute of this piece of code is in fact <span style="color:#2b91af;">ValidationMethod</span>. We will soon see how to use this. The following is the method that checks the value and make a list of <span style="color:#2b91af;">ValidationErrorResult </span>that consists of which rules got failed. Notice that the <span style="color:#2b91af;">ValidationMethod</span> attribute contains the field name of the object which determines no matter whatever your method name is, that field name helps Validation controller to find this method out for validation.</p>
<pre>[<span style="color:#2b91af;">ValidationMethod</span>(<span style="color:#a31515;">"Email"</span>)]
<span style="color:blue;">public static </span><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ValidationErrorResult</span>&gt; ValidateEmail(<span style="color:blue;">object </span>value)
{
    <span style="color:blue;">var </span>email = value <span style="color:blue;">as string</span>;
    <span style="color:blue;">var </span>results = <span style="color:blue;">new </span><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ValidationErrorResult</span>&gt;();

    <span style="color:green;">// Blank
    </span><span style="color:blue;">if </span>(<span style="color:blue;">string</span>.IsNullOrEmpty(email))
        results.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">ValidationErrorResult</span>()
        {
            ErrorMessage = <span style="color:#a31515;">"You did not provide an Email Address."</span>,
            Text = <span style="color:#a31515;">"Cannot be left blank"
        </span>});

    <span style="color:green;">// Length 128
    </span><span style="color:blue;">if </span>(email.Length &gt; 128)
        results.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">ValidationErrorResult</span>()
        {
            ErrorMessage = <span style="color:#a31515;">"You exceeded length limit."</span>,
            Text = <span style="color:#a31515;">"Keep it less than 129 characters"
        </span>});

    <span style="color:green;">// Valid Email Address
    </span><span style="color:blue;">if </span>(!<span style="color:#2b91af;">Regex</span>.IsMatch(email, <span style="color:#a31515;">"^[\\w\\.\\-]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]{1,})*(\\.[a-zA-Z]{2,3}){1,2}$"</span>))
        results.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">ValidationErrorResult</span>()
        {
            ErrorMessage = <span style="color:#a31515;">"You provided an invalid Email Address."</span>,
            Text = <span style="color:#a31515;">"Invalid Email Address"
        </span>});

    <span style="color:green;">// Is Already In Use
    </span><span style="color:blue;">if </span>(IsAlreadyInUse(email))
        results.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">ValidationErrorResult</span>()
        {
            ErrorMessage = <span style="color:#a31515;">"You provided an invalid Email Address."</span>,
            Text = <span style="color:#a31515;">"Invalid Email Address"
        </span>});

    <span style="color:blue;">return </span>results;
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Here is the ValidationController which goes through the Validation class and looks for the method that has the attribute which validates the control&#8217;s value.</p>
<pre><span style="color:blue;">public class </span><span style="color:#2b91af;">ValidationController
</span>{
    <span style="color:blue;">public static </span><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ValidationErrorResult</span>&gt; Validate&lt;T&gt;(<span style="color:blue;">string </span>fieldName, <span style="color:blue;">object </span>value)
    {
        <span style="color:blue;">var </span>results = <span style="color:blue;">new </span><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ValidationErrorResult</span>&gt;();
        <span style="color:blue;">var </span>type = <span style="color:blue;">typeof</span>(T);
        <span style="color:blue;">var </span>methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);

        <span style="color:blue;">var </span>method = methods.Single&lt;MethodInfo&gt;(<span style="color:blue;">delegate</span>(MethodInfo m)
        {
            <span style="color:blue;">return </span>((<span style="color:#2b91af;">ValidationMethodAttribute</span>[])m.GetCustomAttributes(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">ValidationMethodAttribute</span>), <span style="color:blue;">false</span>))[0].FieldName == fieldName;
        });

        <span style="color:blue;">return </span>(<span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ValidationErrorResult</span>&gt;)method.Invoke(<span style="color:blue;">null</span>, <span style="color:blue;">new object</span>[] { value });
    }

    <span style="color:blue;">public static void </span>ValidateControl&lt;T&gt;(<span style="color:#2b91af;">CustomValidator </span>validator, <span style="color:blue;">string </span>fieldName, <span style="color:#2b91af;">ServerValidateEventArgs </span>args)
    {
        <span style="color:blue;">var </span>results = Validate&lt;T&gt;(fieldName, args.Value);

        <span style="color:blue;">if </span>(!(args.IsValid = !(results.Count &gt; 0)))
        {
            validator.ErrorMessage = results[0].ErrorMessage;
            validator.Text = results[0].Text;
        }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/70/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/70/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=70&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/03/28/simple-form-validation-a-reflection-based-approach-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>

		<media:content url="http://tanzimsaqib.files.wordpress.com/2008/03/validators-thumb.png" medium="image">
			<media:title type="html">Validators</media:title>
		</media:content>
	</item>
		<item>
		<title>LINQ to Flickr</title>
		<link>http://tanzimsaqib.wordpress.com/2008/03/01/linq-to-flickr/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/03/01/linq-to-flickr/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 16:06:30 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/03/01/linq-to-flickr/</guid>
		<description><![CDATA[One of my colleagues Mehfuz Hossain developed a wonderful open source project which allows you to query Flickr photos by LINQ, also lets you insert, delete photos directly to/from Flickr. You wonder how to extend LINQ in such an amazing way? It’s easy by writing your own custom LINQ provider, which was not-so-easy until he [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=61&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>One of my colleagues <a href="http://weblogs.asp.net/mehfuzh">Mehfuz Hossain</a> developed a wonderful open source project which allows you to query Flickr photos by LINQ, also lets you insert, delete photos directly to/from Flickr. You wonder how to extend LINQ in such an amazing way? It’s easy by writing your own custom LINQ provider, which was not-so-easy until he came up with another handy open source project named <a href="http://www.codeplex.com/linqextender">LINQ Extender</a><a href="http://www.codeplex.com/linqextender"></a>. He did all the expression parsing stuff to ease our pain. Now you can make your own LINQ to Anything using this so easily.
<p>For your heads up on LINQ extenders, here <a href="http://dotnetslackers.com/articles/csharp/CreatingCustomLINQProviderUsingLinqExtender.aspx">he wrote an article</a> and <a href="http://www.codeplex.com/LINQFlickr">LINQ to Flickr</a>, open source project is hosted at Codeplex.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/61/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/61/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/61/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=61&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/03/01/linq-to-flickr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>
	</item>
		<item>
		<title>A &quot;transactional&quot; generic DbHelper for LINQ to SQL</title>
		<link>http://tanzimsaqib.wordpress.com/2008/02/06/a-transactional-generic-dbhelper-for-linq-to-sql/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/02/06/a-transactional-generic-dbhelper-for-linq-to-sql/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 07:35:10 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/02/06/a-transactional-generic-dbhelper-for-linq-to-sql/</guid>
		<description><![CDATA[In LINQ to SQL, the data model of a relational database is mapped to an object model expressed in the programming language of the developer. When the application runs, LINQ to SQL translates into SQL the language-integrated queries in the object model and sends them to the database for execution. When the database returns the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=59&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In LINQ to SQL, the data model of a relational database is mapped to an object model expressed in the programming language of the developer. When the application runs, LINQ to SQL translates into SQL the language-integrated queries in the object model and sends them to the database for execution. When the database returns the results, LINQ to SQL translates them back to objects that you can work with in your own programming language. You may want to make a data access layer that separates the data operation from business layer like the following:</p>
<pre>DbHelper.Insert&lt;<font color="#2b91af">Student</font>&gt;(
    new <font color="#2b91af">Student</font>()
    {
        FirstName = <span style="color:#a31515;">"Tanzim"</span>,
        LastName = <span style="color:#a31515;">"Saqib"</span>,
        Email = <span style="color:#a31515;">"me@TanzimSaqib.com"</span>,
        Website = <span style="color:#a31515;">"http://www.TanzimSaqib.com"</span></pre>
<pre>}, <span style="color:blue;">true</span>);    <span style="color:green;">// Use Transaction?</span></pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<p>To make use of such transactional generic DbHelper, you might want to write a singeton DbHelper class like the following. You might notice that the class is singleton, it&#8217;s static and the DataContext is being used is private, and only initialized using the connection string if not yet.</p>
<pre><span style="color:blue;">public static class </span><span style="color:#2b91af;">DbHelper
</span>{
    <span style="color:blue;">private const string </span>CONNECTION_CONFIG_NAME = <span style="color:#a31515;">"StudentServerConnectionString"</span>;

    <span style="color:blue;">private static </span>StudentServerDataContext _StudentServerDataContext = <span style="color:blue;">null</span>;

    <span style="color:blue;">public static </span>StudentServerDataContext GetDataContext()
    {
        <span style="color:blue;">if</span>(_StudentServerDataContext == <span style="color:blue;">null</span>)
            _StudentServerDataContext = <span style="color:blue;">new </span>StudentServerDataContext
                (<span style="color:#2b91af;">ConfigurationManager</span>.ConnectionStrings
                [CONNECTION_CONFIG_NAME].ConnectionString);

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

    <span style="color:blue;">public static void </span>CleanUp()
    {
        _StudentServerDataContext.Dispose();
        _StudentServerDataContext = <span style="color:blue;">null</span>;
    }

    <span style="color:green;">// ... code edited to save space</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>On application wide error or on end you can dispose the context so CleanUp method is useful here. To implement an Insert method see the following. You will find I have used a TransactionScope which ensures that the transaction is taking place without any interruption. If there is really any error the scope.Complete() method never gets invoked. This is how it ensures that the code inside the TransactionScope is taking place as a transaction. It is available from .NET 2.0 framework.</p>
<pre><span style="color:blue;">public static void </span>Insert&lt;T&gt;(T t, <span style="color:blue;">bool </span>isTransactional) <span style="color:blue;">where </span>T : <span style="color:blue;">class
</span>{
    <span style="color:blue;">if </span>(isTransactional)
    {
        <span style="color:blue;">using </span>(<span style="color:blue;">var </span>scope = <span style="color:blue;">new </span><span style="color:#2b91af;">TransactionScope</span>())
        {
            Insert&lt;T&gt;(t);

            <span style="color:green;">// On any Exception, Complete() method won't be invoked.
            // So, the transaction will be automatically rollbacked.
            </span>scope.Complete();
        }
    }
    <span style="color:blue;">else
        </span>Insert&lt;T&gt;(t);
}

<span style="color:blue;">public static void </span>Insert&lt;T&gt;(T t) <span style="color:blue;">where </span>T : <span style="color:blue;">class
</span>{
    <span style="color:blue;">using </span>(<span style="color:blue;">var </span>db = GetDataContext())
    {
        db.GetTable&lt;T&gt;().InsertOnSubmit(t);

        <span style="color:blue;">try
        </span>{
            db.SubmitChanges();
        }
        <span style="color:blue;">catch </span>(<span style="color:#2b91af;">Exception </span>e)
        {
            <span style="color:green;">// TODO: log Exception
            </span><span style="color:blue;">throw </span>e;
        }
    }
}</pre>
<p>I did not show other methods as part of the CRUD implementation. The rest is left open for you to implement.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/59/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/59/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=59&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/02/06/a-transactional-generic-dbhelper-for-linq-to-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>
	</item>
		<item>
		<title>[New Article] 7 ways to do Performance Optimization of an ASP.NET 3.5 Web 2.0 portal</title>
		<link>http://tanzimsaqib.wordpress.com/2008/02/05/new-article-7-ways-to-do-performance-optimization-of-an-aspnet-35-web-20-portal/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/02/05/new-article-7-ways-to-do-performance-optimization-of-an-aspnet-35-web-20-portal/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 05:31:00 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/02/05/new-article-7-ways-to-do-performance-optimization-of-an-aspnet-35-web-20-portal/</guid>
		<description><![CDATA[Web 2.0 applications are widely developed. These applications often work with third party contents, aggregate them, make various use of them and then make something useful and meaningful to the users. For the past few years, developers were also engaged with such endeavors and a lot of their websites have not addressed performance issues, thus [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=58&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Web 2.0 applications are widely developed. These applications often work with third party contents, aggregate them, make various use of them and then make something useful and meaningful to the users. For the past few years, developers were also engaged with such endeavors and a lot of their websites have not addressed performance issues, thus resulting in an unpleasant experience to the users.</p>
<p>Performance is a vast area and great results can never be achieved by a silver bullet. <a href="http://dotnetslackers.com/articles/aspnet/SevenWaysToDoPerformanceOptimizationOfAnASPNET35Web20Portal.aspx" target="_blank">This article</a> explores some of the key performance issues that can occur while developing a Web 2.0 portal using server side multithreading and caching. It also demonstrates model driven application development using Windows Workflow Foundation. </p>
<p>URL: <a title="http://dotnetslackers.com/articles/aspnet/SevenWaysToDoPerformanceOptimizationOfAnASPNET35Web20Portal.aspx" href="http://dotnetslackers.com/articles/aspnet/SevenWaysToDoPerformanceOptimizationOfAnASPNET35Web20Portal.aspx">http://dotnetslackers.com/articles/aspnet/SevenWaysToDoPerformanceOptimizationOfAnASPNET35Web20Portal.aspx</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/58/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/58/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=58&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/02/05/new-article-7-ways-to-do-performance-optimization-of-an-aspnet-35-web-20-portal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>
	</item>
		<item>
		<title>HttpRequestFactory vs. XMLHttpRequest in Volta</title>
		<link>http://tanzimsaqib.wordpress.com/2008/01/25/httprequestfactory-vs-xmlhttprequest-in-volta/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/01/25/httprequestfactory-vs-xmlhttprequest-in-volta/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 17:09:05 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Volta]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/01/25/httprequestfactory-vs-xmlhttprequest-in-volta/</guid>
		<description><![CDATA[HttpRequestFactory was designed for use by tiersplitting internally and was not supposed to be exposed as part of the Volta API as Danny van Velzen from Microsoft Volta team told me today. So, its better if you use XMLHttpRequest instead because this factory class might not show up in the later releases. You will find [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=41&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>HttpRequestFactory was designed for use by tiersplitting internally and was not supposed to be exposed as part of the Volta API as Danny van Velzen from Microsoft Volta team told me today. So, its better if you use XMLHttpRequest instead because this factory class might not show up in the later releases. You will find this class in Microsoft.LiveLabs.Volta.Xml namespace.&nbsp; As like as JavaScript&#8217;s one, in this .NET version you can also Open URL, specify method name, and of course pass credentials. You can track response text, xml, status code, status text and also you can abort. </p>
<p>To retrieve your content, you must subscribe to ReadyStateChange event with a HtmlEventHandler which you can find in Microsoft.LiveLabs.Volta.Html namespace and check the status code. If it is 200 that means &#8220;HTTP OK&#8221;, you can take the ResponseText or ResponseXML. See this example:</p>
<pre><span style="color:blue;">string </span>content = <span style="color:blue;">string</span>.Empty;
<span style="color:blue;">var </span>request = <span style="color:blue;">new </span><span style="color:#2b91af;">XMLHttpRequest</span>();

request.ReadyStateChange += <span style="color:blue;">delegate</span>()
{
    <span style="color:blue;">if </span>(request.Status == 200)
        content = request1.ResponseText;
};

request.Open(<span style="color:#a31515;">"POST"</span>, <span style="color:#a31515;">"http://tanzimsaqib.com/feed/"</span>, <span style="color:blue;">true</span>);</pre>
<p>However, you cannot fetch cross domain content by XMLHttpRequest. The Volta compiler creates client side JavaScript XMLHttpRequest and lets developers write code in .NET friendly way. So, I do not think there is any way to retrieve cross domain content in Volta, and leaving us on the same old HttpRequest class.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/41/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/41/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=41&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/01/25/httprequestfactory-vs-xmlhttprequest-in-volta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>
	</item>
		<item>
		<title>[New Article] Building a Volta Control : A Flickr Widget</title>
		<link>http://tanzimsaqib.wordpress.com/2008/01/18/new-article-building-a-volta-control-a-flickr-widget/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/01/18/new-article-building-a-volta-control-a-flickr-widget/#comments</comments>
		<pubDate>Fri, 18 Jan 2008 15:36:31 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Volta]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/01/18/new-article-building-a-volta-control-a-flickr-widget/</guid>
		<description><![CDATA[This is my first article which is based on the first CTP of Volta considering its current limitations. You will see how you can create a Volta control that the compiler can convert into an AJAX Widget without requiring us writing a single line of JavaScript code: http://dotnetslackers.com/articles/aspnet/BuildingAVoltaControlAFlickrWidget.aspx
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=36&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is my first article which is based on the first CTP of Volta considering its current limitations. You will see how you can create a Volta control that the compiler can convert into an AJAX Widget without requiring us writing a single line of JavaScript code: <a title="http://dotnetslackers.com/articles/aspnet/BuildingAVoltaControlAFlickrWidget.aspx" href="http://dotnetslackers.com/articles/aspnet/BuildingAVoltaControlAFlickrWidget.aspx">http://dotnetslackers.com/articles/aspnet/BuildingAVoltaControlAFlickrWidget.aspx</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=36&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/01/18/new-article-building-a-volta-control-a-flickr-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>
	</item>
		<item>
		<title>Make HTML controls discoverable in Volta Control</title>
		<link>http://tanzimsaqib.wordpress.com/2008/01/03/make-html-controls-discoverable-in-volta-control/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/01/03/make-html-controls-discoverable-in-volta-control/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 02:12:42 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Volta]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/01/03/make-html-controls-discoverable-in-volta-control/</guid>
		<description><![CDATA[&#160;
When a Volta control is rendered, the ID attribute of the generated HTML is changed to something like _vcId_1_DivName which is inconvenient to find from code. But the ID attribute stays the same in case of Volta Page, so it is discoverable by ID like this:
Div divContent = Document.GetById&#60;Div&#62;("divContent");

However, if you add HTML controls to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=35&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://labs.live.com/volta/images/logo-volta.png">&nbsp;</p>
<p>When a Volta control is rendered, the ID attribute of the generated HTML is changed to something like _vcId_1_DivName which is inconvenient to find from code. But the ID attribute stays the same in case of Volta Page, so it is discoverable by ID like this:</p>
<pre><span style="color:#2b91af;">Div </span>divContent = Document.GetById&lt;<span style="color:#2b91af;">Div</span>&gt;(<span style="color:#a31515;">"divContent"</span>);</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>However, if you add HTML controls to the control like the following, the ID is not changed during the rendering:</p>
<pre><span style="color:blue;">public </span>VoltaControl1() : <span style="color:blue;">base</span>(<span style="color:#a31515;">"VoltaControl1.html"</span>)
{
    InitializeComponent();

    <span style="color:#2b91af;">Button </span>btnClick = <span style="color:blue;">new </span><span style="color:#2b91af;">Button</span>();
    btnClick.InnerText = <span style="color:#a31515;">"Click!"</span>;
    btnClick.Id = <span style="color:#a31515;">"btnClick"</span>;
    <span style="color:blue;">this</span>.Add(btnClick);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>If you don&#8217;t prefer this way and seriously want to write your own HTML in the control&#8217;s html page, you might find the following snippet useful. But, remember in this case you will use name attribute of the html element instead of ID.</p>
<pre><span style="color:green;">// Usage: var element = GetElementByName(Document.GetElementsByTagName("div"), "divWidget");
</span><span style="color:blue;">private </span><span style="color:#2b91af;">HtmlElement </span>GetElementByName(<span style="color:#2b91af;">HtmlElementCollection </span>elements, <span style="color:blue;">string </span>name)
{
    <span style="color:blue;">foreach </span>(<span style="color:blue;">var </span>element <span style="color:blue;">in </span>elements)
    {
        <span style="color:#2b91af;">DomAttribute </span>nameAttribute = element.Attributes.GetNamedItem(<span style="color:#a31515;">"name"</span>);
        <span style="color:blue;">if </span>(nameAttribute != <span style="color:blue;">null</span>)
            <span style="color:blue;">if </span>(nameAttribute.Value == name)
                <span style="color:blue;">return </span>element;
    }

    <span style="color:blue;">return null</span>;
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=35&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/01/03/make-html-controls-discoverable-in-volta-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>

		<media:content url="http://labs.live.com/volta/images/logo-volta.png" medium="image" />
	</item>
		<item>
		<title>Making cross domain AJAX call using Volta</title>
		<link>http://tanzimsaqib.wordpress.com/2008/01/02/making-cross-domain-ajax-call-using-volta/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/01/02/making-cross-domain-ajax-call-using-volta/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 06:56:51 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Volta]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/01/02/making-cross-domain-ajax-call-using-volta/</guid>
		<description><![CDATA[&#160;
Making a cross domain AJAX call in Volta is piece of cake. Volta compiler generates necessary client codes to make it work. Here is a snippet that can make an AJAX call to some Url and fetch data:
public void DownloadPhotos()
{
    IHttpRequest request = HttpRequestFactory.Create();
    request.AsyncSend("POST", URL, string.Empty,
   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=34&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://labs.live.com/volta/images/logo-volta.png">&nbsp;</p>
<p>Making a cross domain AJAX call in Volta is piece of cake. Volta compiler generates necessary client codes to make it work. Here is a snippet that can make an AJAX call to some Url and fetch data:</p>
<pre><span style="color:blue;">public void </span>DownloadPhotos()
{
    <span style="color:#2b91af;">IHttpRequest </span>request = <span style="color:#2b91af;">HttpRequestFactory</span>.Create();
    request.AsyncSend(<span style="color:#a31515;">"POST"</span>, URL, <span style="color:blue;">string</span>.Empty,
        <span style="color:blue;">delegate</span>(<span style="color:blue;">string </span>response)
        {
            OnPhotosLoaded(<span style="color:blue;">new </span><span style="color:#2b91af;">PhotosLoadedEventArgs</span>(response));
        });
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Both IHttpRequest and HttpRequestFactory classes can be found in the Microsoft.LiveLabs.Volta.MultiTier namespace. AsyncSend method performs the asynchronous call and calls back the delegate defined where OnPhotosLoaded event is fired to notify the subscriber of this event that the data has just arrived.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=34&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/01/02/making-cross-domain-ajax-call-using-volta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>

		<media:content url="http://labs.live.com/volta/images/logo-volta.png" medium="image" />
	</item>
		<item>
		<title>Namespace Alias Qualifier &#8211; to get rid of crazy coding</title>
		<link>http://tanzimsaqib.wordpress.com/2008/01/02/namespace-alias-qualifier-to-get-rid-of-crazy-coding/</link>
		<comments>http://tanzimsaqib.wordpress.com/2008/01/02/namespace-alias-qualifier-to-get-rid-of-crazy-coding/#comments</comments>
		<pubDate>Tue, 01 Jan 2008 19:00:12 +0000</pubDate>
		<dc:creator>tanzimsaqib</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://tanzimsaqib.wordpress.com/2008/01/02/namespace-alias-qualifier-to-get-rid-of-crazy-coding/</guid>
		<description><![CDATA[Let us say somebody in your company loves crazy coding and really do not bother about his/her codes affect others. (S)He put class name System and a constant Console and now wondering how come a simple Console.WriteLine does not compile:
class System
{
    int Console = 10;

    static void Main(string[] args)
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=20&subd=tanzimsaqib&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Let us say somebody in your company loves crazy coding and really do not bother about his/her codes affect others. (S)He put class name System and a constant Console and now wondering how come a simple Console.WriteLine does not compile:</p>
<pre><span style="color:blue;">class </span><span style="color:#2b91af;">System
</span>{
    <span style="color:blue;">int </span>Console = 10;

    <span style="color:blue;">static void </span>Main(<span style="color:blue;">string</span>[] args)
    {
        <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"Hello World!"</span>); <span style="color:green;">// Compile time error
        </span><span style="color:#2b91af;">System</span>.Console.WriteLine(<span style="color:#a31515;">"Hello World!"</span>); <span style="color:green;">// Compile time error
    </span>}
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>Making use of global::System.Console must solve your problem:</p>
<pre><span style="color:blue;">class </span><span style="color:#2b91af;">System
</span>{
    <span style="color:blue;">int </span>Console = 10;

    <span style="color:blue;">static void </span>Main(<span style="color:blue;">string</span>[] args)
    {
        <span style="color:blue;">global</span>::System.<span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"Hello World!"</span>);
        <span style="color:blue;">global</span>::System.<span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"Hello World!"</span>);
    }
}</pre>
<p>However, ever thought of a scenario where there can be same class name under two different namespaces? Here comes the role of Namespace Alias Qualifier. In namespace declaration by &#8220;using&#8221;, aliases can be assigned to namespaces so that they might be useful in later part of the code as shorthand and most importantly will solve the problem of ambiguity:
<pre><span style="color:blue;">using </span>sys = System;
<span style="color:blue;">using </span>mine = MyProject.Process;
...
...
sys.Console.WriteLine(mine.Console[<span style="color:#a31515;">"width"</span>]);</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tanzimsaqib.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tanzimsaqib.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tanzimsaqib.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tanzimsaqib.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tanzimsaqib.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tanzimsaqib.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tanzimsaqib.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tanzimsaqib.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tanzimsaqib.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tanzimsaqib.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tanzimsaqib.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tanzimsaqib.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tanzimsaqib.wordpress.com&blog=1242602&post=20&subd=tanzimsaqib&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tanzimsaqib.wordpress.com/2008/01/02/namespace-alias-qualifier-to-get-rid-of-crazy-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d65a9fc0993ccb92b3897422dbf28d84?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tanzimsaqib</media:title>
		</media:content>
	</item>
	</channel>
</rss>