<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" version="2.0">
    <channel>
        <title>Bigyan Rajbhandari</title>
        <link>http://dotnetlog.com/Default.aspx</link>
        <description>using(technology as Tool) { return;}</description>
        <language>en-US</language>
        <copyright>Bigyan Rajbhandari</copyright>
        <managingEditor>bigyanr@gmail.com</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <image>
            <title>Bigyan Rajbhandari</title>
            <url>http://dotnetlog.com/images/RSS2Image.gif</url>
            <link>http://dotnetlog.com/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/bigyanr" type="application/rss+xml" /><item>
            <title>Using XML to perform database operations rather than parameterized query?</title>
            <category>.Net 2.0-3.5</category>
            <category>Software Development</category>
            <category>Database</category>
            <link>http://dotnetlog.com/archive/2008/08/24/using-xml-to-perform-database-operations-rather-than-parameterized-query.aspx</link>
            <description>&lt;p&gt;There's no doubt that today xml is becoming more and more prevalent as platform-independent data format. Starting SQL server 2005, Microsoft also added tons of support for xml and a new native data type XML, since then I have started to see lots of applications that utilize this data type to run very complex solutions. A new trend is starting to emerge, as one of my colleagues calls it a "paradigm shift", where applications use xml serialized objects (that map to tables) to perform inserts/updates to table rather than having to pass each parameter independently.  However, the question remains if this approach is necessarily better than previous? &lt;/p&gt;
&lt;p&gt;For example consider the following scenario: &lt;br /&gt;
In middle-Tier (.Net Code) my object looks like the following&lt;/p&gt;
&lt;p&gt;&lt;img width="171" height="164" src="/images/dotnetlog_com/082408_1855_UsingXMLtop1.png" alt="" /&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; 		&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;My serialized xml looks like below:&lt;/strong&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Customer&lt;/span&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;customerID&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;12&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;customerName&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Bigyan&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;address&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;123 Redmond Way&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;phone&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;123-123-3434&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;And my call to database stored proc like:&lt;/strong&gt;&lt;br /&gt;
&lt;span style="color: rgb(0, 112, 192);"&gt;exec&lt;/span&gt; Customer_UpdateInformation @customerXml &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In parameterized query I would have done something like this:&lt;br /&gt;
&lt;/strong&gt;&lt;span style="color: rgb(0, 112, 192);"&gt;exec&lt;/span&gt; Customer_UpdateInformation @customerID, @customerName, @addresss, @phone&lt;strong&gt;     &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There are both pros and cons to this approach, which I'll explain next. But I also want to clarify that I am NOT advocating one approach vs other, but actually want your opinion on this approach.  &lt;/p&gt;
&lt;h3&gt;Pros: &lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt;Instead of passing 4 parameters, I need to pass only 1. Thus my signature for the database contract is much more succinct. &lt;/li&gt;
    &lt;li&gt;If I need to add or modify field, I have less code to deal with and do NOT need to change my signature &lt;/li&gt;
    &lt;li&gt;If I am just performing updates on certain fields (not all), I might be able to pass only updated fields and reduce my message size &lt;/li&gt;
    &lt;li&gt;Serialization and Deserialization on my .Net objects can be automated, thus reducing effort to map those fields with database fields. &lt;/li&gt;
    &lt;li&gt;If I wanted to perform bulk updates, then I have ability to pass multiple elements in my xml; this greatly reduces chatting between .Net and Sql Server. &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Cons: &lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt;First and foremost, I'll lose type safety on the parameters passed. &lt;/li&gt;
    &lt;li&gt;Xml parsing is little expensive (not a whole lot), compared to primitive data types. Bulk process might make up ground in this area. &lt;/li&gt;
    &lt;li&gt;
    &lt;div&gt;Data contract I am exposing through the stored procedure is not self explanatory. Just looking at the parameter, no one will know what to pass.  &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
     &lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://dotnetlog.com/aggbug/59.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/08/24/using-xml-to-perform-database-operations-rather-than-parameterized-query.aspx</guid>
            <pubDate>Sun, 24 Aug 2008 18:55:16 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/59.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/08/24/using-xml-to-perform-database-operations-rather-than-parameterized-query.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/59.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Cool Wii Hack by Jonny Lee</title>
            <category>Misc</category>
            <link>http://dotnetlog.com/archive/2008/07/29/cool-wii-hack-by-jonny-lee.aspx</link>
            <description>&lt;p&gt;One of my friends got me into watching ted.com videos, now I can't stop watching it. I just bumped into this WII remote hack video and I can't say how much amused/amazed I am by it.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;!--cut and paste--&gt;&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="432" height="285" id="VE_Player" align="middle"&gt;&lt;param name="movie" value="http://static.videoegg.com/ted2/flash/loader.swf" /&gt;&lt;param name="FlashVars" value="bgColor=FFFFFF&amp;amp;file=http://static.videoegg.com/ted/movies/JOHNNYLEE-2008_high.flv&amp;amp;autoPlay=false&amp;amp;fullscreenURL=http://static.videoegg.com/ted/flash/fullscreen.html&amp;amp;forcePlay=false&amp;amp;logo=&amp;amp;allowFullscreen=true" /&gt;&lt;param name="quality" value="high" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="scale" value="noscale" /&gt;&lt;param name="wmode" value="window" /&gt;&lt;embed src="http://static.videoegg.com/ted2/flash/loader.swf" flashvars="bgColor=FFFFFF&amp;amp;file=http://static.videoegg.com/ted/movies/JOHNNYLEE-2008_high.flv&amp;amp;autoPlay=false&amp;amp;fullscreenURL=http://static.videoegg.com/ted/flash/fullscreen.html&amp;amp;forcePlay=false&amp;amp;logo=&amp;amp;allowFullscreen=true" quality="high" allowscriptaccess="always" bgcolor="#FFFFFF" scale="noscale" wmode="window" width="432" height="285" name="VE_Player" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;img src="http://dotnetlog.com/aggbug/58.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/07/29/cool-wii-hack-by-jonny-lee.aspx</guid>
            <pubDate>Tue, 29 Jul 2008 05:34:16 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/58.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/07/29/cool-wii-hack-by-jonny-lee.aspx#feedback</comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/58.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Signed up to work for the software empire</title>
            <category>Software Development</category>
            <category>Misc</category>
            <link>http://dotnetlog.com/archive/2008/06/16/signed-up-to-work-for-the-software-empire.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial"&gt;That’s right, I recently took a job offer from &lt;a title="" target="_blank" rel="" href="http://microsoft.com"&gt;Microsoft&lt;/a&gt; as a Software Engineer and will be starting there in July. After few months of grueling interview process and tough decision on my part, I decided that it was an opportunity that I couldn’t miss. &lt;br /&gt;
&lt;br /&gt;
So why &lt;a title="" target="_blank" rel="" href="http://microsoft.com"&gt;Microsoft&lt;/a&gt;? Well, there are few things. First ‘aspiration’, I have always wanted to work for the software giant, the fact that you have opportunity to impact millions of people by your work is impassable.  Second, working with smarter people and chance to learn new things every day is appealing. And rest like benefits, location etc.. are definitely added bonus.&lt;br /&gt;
&lt;br /&gt;
Why NOT &lt;a title="" target="_blank" rel="" href="http://microsoft.com"&gt;Microsoft&lt;/a&gt;?  Looking from outside in, I have had doubts if I should take the opportunity. Particularly, the way big corporation works and the “red tape” around the processes. And of course there is a big difference between aspiration and reality. Also, I have heard horror stories of people who came out of there. Someone even asked me if “I sold my soul to the evil empire”. And finally, the rainy weather and expensive real estate in Seattle. But in long term, these were trivial compared to the opportunity. And I should not even complain about the rain compared to snowy winters and humid summers here in Des Moines. And being near to Vancouver is a big bonus for my wife and our family.&lt;br /&gt;
&lt;br /&gt;
My job? It’s still .Net development. I’ll be working for Relationship Experience Division at Issaquah location near Seattle. Currently, I only know the high levels of the projects I might be working on; I guess I’ll find out more once I actually start there. Will I still be blogging? Definitely! I have heard MS is encouraging its employees to blog more. Though I probably won’t be able to blog everything, I’ll try to keep it as up to date as possible.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;When’s the big move? It’s probably going to be July 1st and its coming up pretty fast. Though it’s nice that they will be taking care of everything for the move, I still need to kind of plan for it on my side. And moving from one place to another is definitely not easy. Still need to tie all loose ends at my current work, move and settle in Seattle area in 1 week, enjoy a vacation the following week and then start the grind on Monday!&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;&lt;img src="http://dotnetlog.com/aggbug/57.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/06/16/signed-up-to-work-for-the-software-empire.aspx</guid>
            <pubDate>Mon, 16 Jun 2008 15:02:58 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/57.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/06/16/signed-up-to-work-for-the-software-empire.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/57.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Is V1 of LINQ to SQL only suitable for RAD?</title>
            <category>Database</category>
            <category>LINQ</category>
            <link>http://dotnetlog.com/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx"&gt;In my previous couple posts&lt;/a&gt;, I have been religiously trying to solve the problem or should I say 'find a best pattern' to use with linq to sql. In past few projects, I ventured into Linq to sql world abandoning ORM tools (OR mapper, NHibernate…) that I had been using; however, I have been greatly disappointed by the fact that Linq to sql doesn't support few fundamental concepts/patterns (LINQ to SQL takes a little different approach than traditional ORM tools). I am starting to have serious doubts if V1 of Linq2SQl is even cut out for any n-tier application (I am not even thinking enterprise application). Don't get me wrong, LINQ is a great framework and LINQ to SQL is an awesome extension. But in the real world business application the implementation of LINQ to SQL out of the box is not practical. How did I arrive to this conclusion? Here's how: &lt;/p&gt;
&lt;p&gt;The two fundamental problems it fails to support out of the box are: &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Working with objects in LINQ to SQL in disconnected context is painful. i.e. Most mid-large size applications are designed as n-tier architecture, thus entities within LINQ act more as a container (DTO or Business objects) for carrying data from one tier to another. The problem with LINQ to SQL is that disconnecting from one datacontext and reattaching to another is not trivial. This is a serious drawback given the fact that almost all the applications needs to use this model other than "quick demos". &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
I have seen lots of posts/articles from developers questioning the same problem. Various people have taken a stab at solving this, if you are seriously considering LINQ to SQL read these. &lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 54pt"&gt;
    &lt;li&gt;&lt;a href="http://pampanotes.tercerplaneta.com/2008/03/implementing-n-tier-change-tracking.html"&gt;Benjamin's&lt;/a&gt; ULinqGen project in codeplex allows change tracking in pure POCO models &lt;/li&gt;
    &lt;li&gt;Post by &lt;a href="http://www.west-wind.com/WebLog/posts/134095.aspx"&gt;Rick Strahl&lt;/a&gt;, explaining problem in Linq to SQL in a disconnected environment. &lt;/li&gt;
    &lt;li&gt;
    &lt;div&gt;&lt;a href="http://www.codeplex.com/LINQ2SQLEB"&gt;Matt's Linq2SqlEB&lt;/a&gt; project in codeplex which implements synchronization. &lt;/div&gt;
    &lt;p style="MARGIN-LEFT: 18pt"&gt; &lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;2. &lt;/strong&gt;If you somehow implement an architecture to have live datacontext, one serious issue that you need to focus on is the lifetime management of DataContext. Please be aware, that poorly managed datacontext will bloat eventually and will hamper performance. &lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 54pt"&gt;
    &lt;li&gt;&lt;a href="http://www.dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspxhttp:/www.dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx"&gt;See my previous post&lt;/a&gt; on managing lifetime of datacontext &lt;/li&gt;
    &lt;li&gt;Rick Strahl discusses datacontext lifetime management &lt;a href="http://www.west-wind.net/WebLog/posts/246222.aspx"&gt;here&lt;/a&gt; &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/despos/archive/2008/03/19/more-on-datacontext-in-hopefully-a-realistic-world.aspx"&gt;Dino Esposito&lt;/a&gt;, suggest that you should use atomic context, but I don't see how it would solve the problem if you can't work in a disconnected environment. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br /&gt;
Am I ready to make jump to LinqToSql in my next project from my previous ORM tools? I don't know about others but, I will be holding back until I figure out a best way to work in a disconnected environment, which might be the next project. But the point is disconnected context support will be required. &lt;a href="http://blogs.msdn.com/dinesh.kulkarni/"&gt;Dinesh Kulkarni&lt;/a&gt;, a senior dev for Linq to SQL team advises not use Active Record Pattern, but the problem is I don't see any pattern that I can use effectively in a n-tier architecture, not only the Active Record. LINQ to SQL itself uses great patterns within, but the way datacontext is managed and Entities/child entities are persisted it presents a different problem. It makes for a great presentation or RAD applications so far, but fails to support n-tier applications easily. I am considering concepts of offline datacontext and will follow up with more posts on this. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Is ADO.Net Entity Framework an answer?&lt;br /&gt;
&lt;/strong&gt;Not really. The framework uses same concept of active context as Linq to SQL and quickly runs into the problem in a disconnected environment. I haven't done an in-depth implementation of it but the problem seems to be the same. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Let me know what you guys think of LINQ to SQL. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://dotnetlog.com/aggbug/56.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx</guid>
            <pubDate>Tue, 25 Mar 2008 03:31:38 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/56.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/56.aspx</wfw:commentRss>
        </item>
        <item>
            <title>(Follow Up)  Best practice and effective use of DataContext in LINQ</title>
            <category>Database</category>
            <category>LINQ</category>
            <link>http://dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;NOTE: 3/24/2008 - The problem of working with LINQ to sql extends beyond lifetime management of DataContext, thus I am scrapping the second part of my blog. Only thing useful in this post is the performance comparision. &lt;a href="http://www.dotnetlog.com/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx"&gt;Here's new post on LINQ to SQL&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In my previous post&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt;, I had probed a question on how to effectively incorporate DataContext in ones pattern so the ease of use and unit of work is well represented. Thanks to everyone who provided feedback, it definitely was a good read and provided lots of insight. Few reasons we got into asking this question instead of using simple create/dispose model, in the first place was &lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt;We wanted to make it so that it was easy to use &lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt;We heavily use Repository Pattern for business logic/transaction scoping and Entity model for CRUD operations, so wanted to make sure datacontext we used was as efficient as possible. &lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt;Concerns regarding efficiency of creating/disposing datacontext and not being able to use caching of datacontext effectively. &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt;&lt;strike&gt;However, after reading several posts and looking deeper into datacontext, it seems that creating/disposing it as required is the best way to go&lt;/strike&gt;. In order, to get rid of any suspicion I even created a little test to compare Ambient Context and Instantiation as required model, results are below. In the image below, first method GetByID(int32) actually instantiates datacontext everytime, where as the second one takes in a datacontext instantiated once by the caller (code is included at the bottom of the post). The results are impressive for dynamic instantiation. 23.7 secs vs. 20.9 secs for 6200 iterations. I think 3 secs is a reasonable margin not taking into account impact in memory with ambient datacontext or the efficiency of caching. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://dotnetlog.com/images/dotnetlog_com/032008_2146_FollowUpBe1.png" /&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt;&lt;strike&gt;Either way, I believe for our purpose and in general a repository pattern incorporated with entity model should work pretty well. One thing Jeff did point out to me however was, once you have disposed your datacontext, any attempt to load/access child objects that is marked for lazy load will throw disposed object error as below. So make sure you load your objects while the context is alive, once that is done subsequent access is successful. &lt;/strike&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://dotnetlog.com/images/dotnetlog_com/032008_2146_FollowUpBe2.png" /&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Timers;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Diagnostics;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; ConsoleApplication4
{
    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program
    {
        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
        {
&lt;span class="rem"&gt;//Create &amp;amp; dispose Context everytime&lt;/span&gt;
            Test1();
            
        &lt;span class="rem"&gt;//Ambient Context Concept&lt;/span&gt;
Test2();
        }

&lt;span class="rem"&gt;//Create datacontext everytime&lt;/span&gt;
        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Test1()
        {
            List&amp;lt;EcardOrder&amp;gt; orders;
            &lt;span class="kwrd"&gt;using&lt;/span&gt; (MercyDataContext dbContext = &lt;span class="kwrd"&gt;new&lt;/span&gt; MercyDataContext())
            {
                &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 100; i++)
                {
                    orders = dbContext.EcardOrders.ToList();
                    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (EcardOrder order &lt;span class="kwrd"&gt;in&lt;/span&gt; orders)
                    {
                        &lt;span class="rem"&gt;//Datacontext will be created everytime &lt;/span&gt;
&lt;span class="rem"&gt;// in this function&lt;/span&gt;
                        Ecard card = Ecard.GetByID(order.EcardID);
                    }
                }
            }
        }

        
&lt;span class="rem"&gt;//Create datacontext only once&lt;/span&gt;
        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Test2()
        {
            List&amp;lt;EcardOrder&amp;gt; orders;
            &lt;span class="kwrd"&gt;using&lt;/span&gt; (MercyDataContext dbContext = &lt;span class="kwrd"&gt;new&lt;/span&gt; MercyDataContext())
            {
                &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 100; i++)
                {
                    orders = dbContext.EcardOrders.ToList();
                    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (EcardOrder order &lt;span class="kwrd"&gt;in&lt;/span&gt; orders)
                    {
                        &lt;span class="rem"&gt;//Pass datacontext to the function as well&lt;/span&gt;
                        Ecard card = Ecard.GetByID(order.EcardID, dbContext);
                    }
                }
            }
        }


    }

    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
    &lt;span class="rem"&gt;/// Partial Ecard class extended from database&lt;/span&gt;
    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Ecard
    {
        &lt;span class="rem"&gt;//new datacontext is created and disposed everytime.&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Ecard GetByID(&lt;span class="kwrd"&gt;int&lt;/span&gt; ID)
        {
            &lt;span class="kwrd"&gt;using&lt;/span&gt; (MercyDataContext _context = &lt;span class="kwrd"&gt;new&lt;/span&gt; MercyDataContext())
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _context.Ecards.SingleOrDefault(e =&amp;gt; e.EcardID == ID);
            }
        }

        &lt;span class="rem"&gt;//Puesdo concept of ambient datacontext&lt;/span&gt;
        &lt;span class="rem"&gt;//NOTE: once the Ecard is loaded it is cached in the context, &lt;/span&gt;
        &lt;span class="rem"&gt;//thus items will be returned from cache&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Ecard GetByID(&lt;span class="kwrd"&gt;int&lt;/span&gt; ID, MercyDataContext _context)
        {
            &lt;span class="kwrd"&gt;return&lt;/span&gt; _context.Ecards.SingleOrDefault(e =&amp;gt; e.EcardID == ID);
        }
    }


}
&lt;/pre&gt;&lt;img src="http://dotnetlog.com/aggbug/55.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx</guid>
            <pubDate>Thu, 20 Mar 2008 21:46:24 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/55.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/55.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Best practice and effective way of using DataContext in Linq to SQL?</title>
            <category>ASP.Net</category>
            <category>.Net 2.0-3.5</category>
            <category>Software Development</category>
            <category>Database</category>
            <link>http://dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;NOTE: See my &lt;/strong&gt;&lt;a href="http://www.dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx"&gt;&lt;strong&gt;follow up post here&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; for more info.&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;At work, Jeff and I have been throwing around ideas to find a best way to implement DataContext in Linq so that we can integrate it into the base class in our framework while achieving following goals. &lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font size="2"&gt;Implementation should be easy and non-redundant, so that we do not need to do &lt;span style="COLOR: blue"&gt;new DataContext(), &lt;/span&gt;every time we have to use one. &lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;Portability of the DataContext should be such that we do not need to pass it around as parameters from one tier to another. &lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;"Unit of work" pattern should be well represented and "very" transparent. &lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;Context should not be persisted without intent, or be open to manipulation from other methods, such that "unit of work" is compromised or a transaction is ill-represented &lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font size="2"&gt;These seem like simple goals given the features and flexibility of LINQ, however, in reality this has become much more difficult and annoying to achieve than we previously thought. Here are several ideas we have been kicking around, and problem it presents. &lt;strong&gt;I would like to hear from people who have effectively used LINQ Datacontext in these scenarios or in a pattern that's most effective. &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;1. Creating and disposing LINQ as required.&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;font face="Arial"&gt;&lt;span style="COLOR: #2b91af"&gt;DbDataContext&lt;/span&gt; myContext = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;DbDataContext&lt;/span&gt;(); &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: green"&gt;&lt;font face="Arial"&gt;//your code goes here &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;font face="Arial"&gt;myContext.SubmitChanges(); &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;&lt;strong&gt;Problems with this pattern:&lt;/strong&gt; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 72pt"&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;Creating datacontext everytime we need to use is cumbersome and in my opinion just verbose. &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;If you have to use datacontext in any of the method this code calls, you'll have to pass the datacontext with it. This is one- too many parameters to pass around &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
    &lt;p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;2. Creating a static DataContext and using it throughout the application.&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;DataLayer.DataContext.Current&lt;/span&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;&lt;strong&gt;Problems with this pattern:&lt;/strong&gt; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 72pt"&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;Creating static object isn't always a good thing. In this case, the context is available for manipulation at any level. And unit of work quickly becomes very hard to maintain &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;If manipulated by other threads or methods context isn't clean anymore and cannot be trusted&lt;br /&gt;
    &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;&lt;strong&gt;3. Ambient DataContext (Currently using this)&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;The idea behind ambient datacontext is that context is created for a particular thread or a httpcontext(in asp.net) as soon as there is a first call for the DataContext. Then the same context is used for that thread or request unless it is disposed manually. This is done by storing the context in the request/thread data store. The approach to this pattern is similar to static DataContext, however, separation is provided for each thread and requests. This works really well in Asp.Net, however, is again plagued by some of the problems of static context.&lt;strong&gt; &lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;&lt;strong&gt;Problems with this pattern:&lt;/strong&gt; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 72pt"&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;The context is available for manipulation at any level. And quickly becomes very hard to maintain unit of work &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;Portability across thread is very hard &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;Unit of work pattern is not transparent enough&lt;br /&gt;
    &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;4.  Finally, the last idea we've been trying to come up with is concept similar to TransactionScope.&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;In this pattern, you would used &lt;strong&gt;using&lt;/strong&gt;{ } block to initialize your context and represent a "Datacontext Scope". Any method below that will automatically be able to figure out the proper context, through thread/request datastore. Then just before the dispose happens, you manually call the &lt;strong&gt;SubmitChanges&lt;/strong&gt;() method. This is the one I like so far, however, has few practical problems. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;&lt;strong&gt;Problems with this pattern:&lt;/strong&gt; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 72pt"&gt;
    &lt;li&gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;font size="2"&gt;If sub method needs to implement a new context, we need to figure out how to exclude it from the parent context's using block. If allowing multiple contexts in multiple using blocks, how do you determine which context to use in sub-sub methods? &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Please do comment on what you think is the best approach to solving this problem.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://dotnetlog.com/aggbug/53.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx</guid>
            <pubDate>Wed, 19 Mar 2008 01:51:33 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/53.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/53.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Is VB.Net better or C#.net? Or is .Net a .Net either way?</title>
            <link>http://dotnetlog.com/archive/2008/02/07/is-vb.net-better-or-c.net-or-is-.net-a-.net.aspx</link>
            <description>&lt;p&gt;As a .net programmer at some point in your life, you probably have gotten into a discussion or at least faced a choice between VB.net and C#.net. Though the argument is never ending on both sides&lt;strong&gt;, how do programmer that are bilingual or someone who is just learning feel? What long term productivity impact does this have in development shop or team in general? 
&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Well for me, I clearly have choice in mind, but instead of presenting my views today, I will publish the following list our good friend Jeff Lanning compiled from various sources few years back. Though some of the points have changed with new version of .Net, I hope it provides a good reference for anyone dealing with such a choice.  Here it goes; &lt;strong&gt;don't forget to put in your two cents&lt;/strong&gt;:
&lt;/p&gt;&lt;h3&gt;Reasons to Choose C# over VB.NET:
&lt;/h3&gt;&lt;p&gt;C# was designed expressly for the .NET platform and Microsoft is standardizing their company on it, which means they have a much deeper investment in C# technologies (language features, compilers, dev tools, etc) than they do in VB.NET.  In fact, both Visual Studio and the .NET Framework where written in C# (using C++ as a backend).  Furthermore, C# was submitted to, and standardized by, the ECMA group as an open standard while VB remains proprietary.
&lt;/p&gt;&lt;p&gt; The C# language is very similar to the other major languages (like Java, JavaScript, C/C++, PHP, and Perl) and shares many of the same concepts, keywords, and syntactical elements.  These similarities means a C# programmer will be more able to read, write, and borrow code from those other languages.  Most programming books not specific to any one programming language (e.g., books on UML, data structures, OOP concepts, etc.) are likely to include examples in Java.
&lt;/p&gt;&lt;p&gt; Outside of the endless language features debate, C# has become the defacto standard for .NET development.  A majority of third-party and open source components are written in C#.  A majority of advanced programming articles are written in C#.  Microsoft's application blocks and other development resources are also provided first in C#, and later converted to VB.NET.  If anything, .NET developers owe it to themselves to learn C# for that reason alone (even if they think VB is still the greatest thing since the Apple IIe).  As long as they never have to modify or inspect anyone else's .NET code, it may be fine to ignore C# for the time being, but chances are that isn't going to be the case for very long if they want to take advantage of the rapidly growing .NET community's resources.
&lt;/p&gt;&lt;p&gt; Most students coming out of college have experience with Java and/or C++, making the transaction to C# quite natural.  In addition, these young professionals will likely see VB.NET in the same light as COBOL with its legacy-ridden, verbose BASIC syntax, and be drawn to C# as the best long-term choice for professional grown.
&lt;/p&gt;&lt;p&gt; The learning curve going from VB6 to either VB.NET or C# is about the same given that 95% of the effort will be spent learning the object model of the .NET Framework, the new development tools, new OOP concepts, and all the new techniques involved in developing Windows or Web applications in .NET.  While VB.NET might seem to be just an improved version of VB6, they are really two languages that are eerily similar, but perversely different.  In fact, many experienced VB developers may find C# easier to learn (although a bit more uncomfortable at first) because it helps draw a clean distinction between the two development platforms and avoids many pitfalls associated with bringing a VB6 mindset into the .NET world (like using "On Error GoTo").  There is much to be said for starting with a clean slate.
&lt;/p&gt;&lt;p&gt; VB.NET does not have native support for XML embedded documentation, which is used by IntelliSense and to auto-generate class reference documentation directly from the code (with tools like NDoc, DocGen, and many others).  The absence of this feature alone is a strong reason to avoid VB.NET on large development projects.  This limitation will be fixed in the VS2005 release.
&lt;/p&gt;&lt;p&gt; Over the next few years, Microsoft will be differentiating the VB.NET and C# product lines.  VB.NET will diverge to provide a better RAD (Rapid Application Development) experience, while C# will diverge to provide a better experience building complicated business frameworks, backend services, application architecture, and reusable object-oriented components.  For smaller projects, either language will be a fine choice, but as the size and complexity of applications increase, the productivity gain from C# will likely outweigh that of VB.NET.
&lt;/p&gt;&lt;h3&gt; Language-specific reasons C# is a better choice…
&lt;/h3&gt;&lt;p&gt;- less verbosity (e.g., easier to find the "important" words in the code)
&lt;/p&gt;&lt;p&gt;- assignment operator is not the same as the comparison operator
&lt;/p&gt;&lt;p&gt;- &lt;span style="text-decoration:line-through"&gt;Native XML code documentation (which drives IntelliSense notes)&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;- does not hide "Advanced Members" of classes
&lt;/p&gt;&lt;p&gt;- simplified type casting syntax (instead of directcast(), ctype(), cbool(), etc...) 
&lt;/p&gt;&lt;p&gt;- case-sensitivity (allowing for better variable names in many cases)
&lt;/p&gt;&lt;p&gt;- 'OnError GoTo' is impossible
&lt;/p&gt;&lt;p&gt;- option explicit by default (enforces correct type usage)
&lt;/p&gt;&lt;p&gt;- cleaner null test expressions ("obj != null"  rather than "not obj is nothing")
&lt;/p&gt;&lt;p&gt;- better variable scope containment in loops and code blocks
&lt;/p&gt;&lt;p&gt;- automatic logic short circuiting (streamlining common test/use logic)
&lt;/p&gt;&lt;p&gt;- &lt;span style="text-decoration:line-through"&gt;'using' blocks for clean/safe resource management&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;- continue / break statements supported in loops
&lt;/p&gt;&lt;p&gt;- embed special string characters ('\n', '\r', '\t', etc…)
&lt;/p&gt;&lt;p&gt;- string escaping ('@')
&lt;/p&gt;&lt;p&gt;- &lt;span style="text-decoration:line-through"&gt;comment support is just better (multiline comments, XML comments, single-line comments, etc…)&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;- as operator (string s = obj as string)
&lt;/p&gt;&lt;p&gt;- native increment/decrement supported ('--' and '++' )
&lt;/p&gt;&lt;p&gt;- &lt;span style="text-decoration:line-through"&gt;intellisense is much less interfering&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;- arrays are defined with number of elements, not the upper bounded index
&lt;/p&gt;&lt;p&gt;- hierarchical constructor calling (ctor() : ctor("defaultValue")) 
&lt;/p&gt;&lt;p&gt;- array/collection indexer is not the same as a function call ('[0]' vs '(0)')
&lt;/p&gt;&lt;p&gt;- 'ByVal' is very misleading (it passes a pointer (ie reference), not a value; whereas 'ByRef' passes a pointer to a pointer) 
&lt;/p&gt;&lt;p&gt;- unsigned values (uint, ulong) 
&lt;/p&gt;&lt;p&gt;- P/Invoke makes much more sense, and is uberly easier to figure out 
&lt;/p&gt;&lt;p&gt;- doesn't hide delegate usage (AddressOf)
&lt;/p&gt;&lt;p&gt;- &lt;span style="text-decoration:line-through"&gt;more optimized MSIL generation&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;- operator overloading
&lt;/p&gt;&lt;p&gt;- pointers
&lt;/p&gt;&lt;p&gt;- event syntax 
&lt;/p&gt;&lt;p&gt;- delegate syntax 
&lt;/p&gt;&lt;p&gt;- unmanaged/unsafe code supported
&lt;/p&gt;&lt;p&gt;- &lt;span style="text-decoration:line-through"&gt;'Default Namespace' doesn't just prefix your classes namespace&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;- EntryPoint isn't hidden ([STATThread] static void Main(string[] args)) 
&lt;/p&gt;&lt;p&gt; 
 &lt;/p&gt;&lt;h3&gt; From a discussion thread:
&lt;/h3&gt;&lt;p&gt; Actually I'm little concerned about VB's future with the graduating generation of programmers.  Most of today's universities are teaching Java as a primary learning tool.  And usually the academics view VB as a clumsy language for lazy programmers.  Decades ago the most supreme business language was COBOL.  Those who had a chance working with it know it is an outstanding language that is dead meat, not because it is not used anymore (70% of World's applications remain bounded by it) but because the new generations learned from their teachers that computer science is science, COBOL is for business and C is for math (math is science).  Some may argue that there is COBOL.Net, however, seniors can't stand OO way of thinking, juniors can't stand OLD language stigma so it is also dead before it is born.  Having C language culture and nowadays Java transferred from teachers to students, what do you think IT managers will prefer for their departments growing potentials if they choose to acquire .NET? 
&lt;/p&gt;&lt;p&gt; 
 &lt;/p&gt;&lt;p&gt;If I was a manager I would surely choose C# for several reasons: 
&lt;/p&gt;&lt;p&gt;1) So I can get the brightest of new (low paid) grads up and running in no time. 
&lt;/p&gt;&lt;p&gt;2) So I can get to that C++ like language fame surrounding my projects and yet get it RAD. 
&lt;/p&gt;&lt;p&gt;3) So I can leave infamous VB lazy clumsy programmers gossips roam as they wish without feeling their sting. 
&lt;/p&gt;&lt;p&gt; 
 &lt;/p&gt;&lt;p&gt;But I am a developer so I choose C# for: 
&lt;/p&gt;&lt;p&gt;1- No job is secure, so I'd better get used to curly brackets and once I learn most of XML, web services, SOAP, etc., then I am empowered to switch easily to that other half of corporate world that is using J2EE. 
&lt;/p&gt;&lt;p&gt;2- It's more stylish and attractive (yes it does matter if you are going to spend most of your day on something then better love it). 
&lt;/p&gt;&lt;p&gt;3- Because VB's parents Bill and Mic seem to undermarket it in favor of C# (could it be they are trying to abandon the ship?).
&lt;/p&gt;&lt;p&gt;  
 &lt;/p&gt;&lt;h3&gt;From a discussion thread:
&lt;/h3&gt;&lt;p&gt; We chose VB.NET a year ago and we regret it.  We have 25 very bright developers and a substantial ecommerce web site with plenty of traffic.  One year ago we kicked off our port to .NET and we chose VB6 because our existing code base was VB6 and ASP.  A few of us here had significant C# expertise from previous jobs and warned the bosses that the "advantages" of VB.NET were a mirage and that there were some clear disadvantages.  They actually thought the "automatic conversion" tools were going to buy us some time.  The pointy-haired contingent won out and not a day goes by that we don't curse them for forcing VB.NET on us. 
&lt;/p&gt;&lt;p&gt; As other's have said, you take a big hit moving to .NET at all.  The tiny additional hit of moving talented VB6 developers to C# is more than offset (IMHO) by the increased developer productivity achieved over the medium to long term in C#.  (If your team is not very talented -- or not talented in that way -- YMMV.) 
&lt;/p&gt;&lt;h3&gt; Why do I think I am more productive in C# than in VB.NET? Here are a few reasons: 
&lt;/h3&gt;&lt;p&gt;1. VB.NET has abysmal static code analysis: functions that don't return values, uninitialized variables, unused variable declarations, etc... This is what a compiler is *for*.  I wish VB.NET had an "Option ReallyStrict On" so it would check things as thoroughly as the C# compiler does.  You can spend hours trying to track down which uninitialized variable or non-returning pathway in a function is the source of a bug, when the compiler could just tell you. 
&lt;/p&gt;&lt;p&gt;2. VB.NET has more aggressive background compilation that you can't turn off or control in any way and which is buggy! We have solutions for our web site with 30 projects and some projects with hundreds of files. You can't add a method to a class without taking a coffee break while intellisense chews up a CPU. We're reduced to having to buy double cpu machines for developers so that they can just type at full speed. And even then all that CPU is wasted because the background compilation just can't keep up. I wish there were an option for intellisense so that you could *tell* VB.NET when to recompile and when to just chill out because I'm typing a raft of code. 
&lt;/p&gt;&lt;p&gt;3. VB.NET (still) has lurking intellisense bugs whether you use project dependencies or file dependencies. Whichever you choose, you're stuck with a different set of problems ("can't copy dll X [v1.1.3000.1] over dll X [v1.1.3000.2]" or "dll A requires a reference to dll B" or "can't copy dll Y to c:\foo\bar\y.dll because it is locked") 
&lt;/p&gt;&lt;p&gt;4. VB.NET has no "using" directive. I know it's just syntactic sugar... but I want more sugar. The truth is that interacting with non-managed resources (ie. the OS or the database) in .NET sucks even in C#. But having to write "Dim x ... Try ... Finally .... x.dispose EndTry" all the time is just pouring salt in the wound. 
&lt;/p&gt;&lt;p&gt;5. VB.NET has no multiline comment syntax 
&lt;/p&gt;&lt;p&gt;6. VB.NET has no within-the-line comment syntax 
&lt;/p&gt;&lt;p&gt;7. VB.NET has no multiline string syntax 
&lt;/p&gt;&lt;p&gt;8. VB.NET has a limit on line continuations (what is it, like 10 lines)? 
&lt;/p&gt;&lt;p&gt;9. VB.NET projects cannot have pre-build or post-build steps (large, real-world projects inevitably need them) 
&lt;/p&gt;&lt;p&gt;10. VB.NET has no built-in comment-&amp;gt;documentation generator 
&lt;/p&gt;&lt;p&gt; 
 &lt;/p&gt;&lt;p&gt;And in case anyone is still reading... it's hard to think of any advantage we've seen in using VB.NET.  Maybe one: it made some COM coding easier because we could use late binding.  I'd say if you are doing lots of COM interop especially if you need late binding, VB.NET is necessary.  But I don't recommend doing any more COM interop than you absolutely have to and late binding is worse than evil.
&lt;/p&gt;&lt;p&gt; 
 &lt;/p&gt;&lt;p&gt;I think that pointy-haired types think that VB.NET will make it "faster".  That the learning curve will be less steep or that fewer changes will need to be made to the code.  It just doesn't work that way.  Your project will take 2 or 3 times as long as you anticipated, even if you pick VB.NET.  And when you choose VB.NET you may get started faster but you'll be paying a tax forever, because the language and tools just aren't as good as C#.  I'm crossing my fingers for VB improvements in 2005, but I'm not holding my breath.  Doubtless something else will be "missed" (like multi-language projects were this time) and we'll still be stuck in a VB.NET ghetto.&lt;/p&gt;&lt;img src="http://dotnetlog.com/aggbug/52.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/02/07/is-vb.net-better-or-c.net-or-is-.net-a-.net.aspx</guid>
            <pubDate>Fri, 08 Feb 2008 04:45:11 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/52.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/02/07/is-vb.net-better-or-c.net-or-is-.net-a-.net.aspx#feedback</comments>
            <slash:comments>17</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/52.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Little Known Feature of RDP 6.0 – Multi-monitor Support</title>
            <link>http://dotnetlog.com/archive/2008/01/19/little-known-feature-of-rdp-6.0--multi-monitor-support.aspx</link>
            <description>&lt;p&gt;Remote Desktop/VNC is undoubtedly one of the coolest and a most convenient tool for working remotely. However, the lack of multi-monitor support and slow response was always inconvenient. RDP client 6.0 released by Microsoft last year, however, solved that issue by supporting RDP resolution of up to 4096 x 2048 pixels. That means now you can have multiple monitors up to 4096 x 2048 pixel cumulative resolution. All you have to do is, launch mstsc with /span argument.
&lt;/p&gt;&lt;p&gt;i.e. on the run window type: &lt;strong&gt;mstsc /span&lt;/strong&gt;
	&lt;/p&gt;&lt;p&gt;To download or for more information go to &lt;a href="http://support.microsoft.com/kb/925876"&gt;http://support.microsoft.com/kb/925876&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;Please note that along with the above download, you'll also need new version of RDP support on the server/computer you are connecting to. Other features include 32bit color support and support for plug &amp;amp; play devices.&lt;/p&gt;&lt;img src="http://dotnetlog.com/aggbug/51.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2008/01/19/little-known-feature-of-rdp-6.0--multi-monitor-support.aspx</guid>
            <pubDate>Sat, 19 Jan 2008 17:23:01 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/51.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2008/01/19/little-known-feature-of-rdp-6.0--multi-monitor-support.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/51.aspx</wfw:commentRss>
        </item>
        <item>
            <title>“Add” extension method in Linq deprecated in VS 2008 RTM</title>
            <link>http://dotnetlog.com/archive/2007/12/02/add-extension-method-in-linq-deprecated-in-vs-2008-rtm.aspx</link>
            <description>&lt;p&gt;Well, one of the "perks" of working in beta and switching to rtm is definitely the few surprises that come along. In VS 2008 Beta2 Linq entities had 'Add' method that allowed you to add an object to the current datacontext. Surprisingly, it is removed and renamed to 'InsertOnSubmit' on the RTM. It took me a while to figure that out, cause most of the stuff I had written previously was working fine. And I was so confident that my extention method had gone missing, that I started scouring through Reflector, instead of googling. Anyway, this info should help anyone, who's trying to hunt the add method. For disconnected updates however, attach method still exists.&lt;/p&gt;&lt;img src="http://dotnetlog.com/aggbug/50.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2007/12/02/add-extension-method-in-linq-deprecated-in-vs-2008-rtm.aspx</guid>
            <pubDate>Mon, 03 Dec 2007 02:19:25 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/50.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2007/12/02/add-extension-method-in-linq-deprecated-in-vs-2008-rtm.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/50.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Got MCPD ed!</title>
            <link>http://dotnetlog.com/archive/2007/11/13/got-mcpded.aspx</link>
            <description>&lt;p&gt;Finally passed my Microsoft 70-551 test and got the MCPD certification. To Tell you the truth the new generation of tests are really rigorous than before, esp. 70-549, took few tries to get pass it. Also, this was an upgrade test and had 88 questions for 4 hours, was kinda tiring. Anyway, studying for it provided some insightful knowledge.&lt;/p&gt;&lt;img src="http://dotnetlog.com/aggbug/49.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Bigyan Rajbhandari</dc:creator>
            <guid>http://dotnetlog.com/archive/2007/11/13/got-mcpded.aspx</guid>
            <pubDate>Wed, 14 Nov 2007 02:08:00 GMT</pubDate>
            <wfw:comment>http://dotnetlog.com/comments/49.aspx</wfw:comment>
            <comments>http://dotnetlog.com/archive/2007/11/13/got-mcpded.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://dotnetlog.com/comments/commentRss/49.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
