<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Bigyan Rajbhandari</title><subtitle type="html">All about technology...</subtitle><id>http://weblogs.asp.net/bigyanr/atom.aspx</id><link rel="alternate" type="text/html" href="http://weblogs.asp.net/bigyanr/default.aspx" /><link rel="self" type="application/atom+xml" href="http://weblogs.asp.net/bigyanr/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20510.895">Community Server</generator><updated>2007-10-16T07:49:00Z</updated><entry><title>Is V1 of LINQ to SQL only suitable for RAD?</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/bigyanr/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx" /><id>http://weblogs.asp.net/bigyanr/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx</id><published>2008-03-25T03:36:00Z</published><updated>2008-03-25T03:36:00Z</updated><content type="html">&lt;P&gt;&lt;A href="http://dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx" mce_href="http://dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx" _fcksavedurl="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;A class="" title="Click here to read more..." href="http://dotnetlog.com/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx" mce_href="http://dotnetlog.com/archive/2008/03/24/is-v1-of-linq-to-sql-only-suitable-for-rad.aspx"&gt;Click here to read more... &lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6021847" width="1" height="1"&gt;</content><author><name>bigyanr</name><uri>http://weblogs.asp.net/members/bigyanr.aspx</uri></author><category term="SQL" scheme="http://weblogs.asp.net/bigyanr/archive/tags/SQL/default.aspx" /><category term="LINQ" scheme="http://weblogs.asp.net/bigyanr/archive/tags/LINQ/default.aspx" /></entry><entry><title>(Follow Up) Best practice and effective use of DataContext in LINQ </title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/bigyanr/archive/2008/03/20/follow-up-best-practice-and-effective-use-of-datacontext-in-linq.aspx" /><id>http://weblogs.asp.net/bigyanr/archive/2008/03/20/follow-up-best-practice-and-effective-use-of-datacontext-in-linq.aspx</id><published>2008-03-20T22:11:00Z</published><updated>2008-03-20T22:11:00Z</updated><content type="html">&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#ff0000&gt;NOTE: 3/24/2008 -&amp;nbsp;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" _fcksavedurl="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" _fcksavedurl="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;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;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 mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: white"&gt;&lt;A class="" title="Click here to read more" href="http://www.dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx" mce_href="http://www.dotnetlog.com/archive/2008/03/20/follow-up--best-practice-and-effective-use-of-datacontext.aspx"&gt;&amp;nbsp;Click here to read more...&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6001699" width="1" height="1"&gt;</content><author><name>bigyanr</name><uri>http://weblogs.asp.net/members/bigyanr.aspx</uri></author><category term="LINQ" scheme="http://weblogs.asp.net/bigyanr/archive/tags/LINQ/default.aspx" /><category term="asp.net" scheme="http://weblogs.asp.net/bigyanr/archive/tags/asp.net/default.aspx" /><category term=".net" scheme="http://weblogs.asp.net/bigyanr/archive/tags/.net/default.aspx" /><category term="DataContext" scheme="http://weblogs.asp.net/bigyanr/archive/tags/DataContext/default.aspx" /></entry><entry><title>Best practice and effective way of using DataContext in Linq to SQL?</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/bigyanr/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq-to-sql.aspx" /><id>http://weblogs.asp.net/bigyanr/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq-to-sql.aspx</id><published>2008-03-19T01:52:00Z</published><updated>2008-03-19T01:52:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&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;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&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;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&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;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;“Unit of work” pattern should be well represented and “very” transparent. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&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;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&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. 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;/FONT&gt;&lt;/P&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt; 
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo2"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Creating and disposing &lt;B style="mso-bidi-font-weight: normal"&gt;LINQ as required&lt;/B&gt;. &lt;/FONT&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&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;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;//your code goes here&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;myContext.SubmitChanges();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Courier New'; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-no-proof: yes"&gt;Problems with this pattern:&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;FONT face=Calibri&gt;Creating datacontext everytime we need to use is cumbersome and in my opinion just verbose.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;FONT face=Calibri&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;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt; 
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo2"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Creating a &lt;B style="mso-bidi-font-weight: normal"&gt;static DataContext&lt;/B&gt; and using it throughout the application.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataLayer.DataContext.Current&lt;/SPAN&gt;&lt;/P&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Courier New'; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-no-proof: yes"&gt;Problems with this pattern:&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;FONT face=Calibri&gt;Creating static object isn’t always a good thing. In this case, the context is available for manipulation at any level. And quickly becomes very hard to maintain unit of work &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;FONT face=Calibri&gt;If manipulated by other threads or methods context isn’t clean anymore and cannot be trusted&lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;Ambient DataContext – &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;The idea behind ambient datacontext is that context is created for a particular thread or a request (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;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Courier New'; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;Problems with this pattern:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt; 
&lt;P mce_keep="true"&gt;&lt;A class="" title="Click here to read more..." href="http://www.dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx" mce_href="http://www.dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx"&gt;&lt;STRONG&gt;Click here to read more...&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5997053" width="1" height="1"&gt;</content><author><name>bigyanr</name><uri>http://weblogs.asp.net/members/bigyanr.aspx</uri></author><category term="SQL" scheme="http://weblogs.asp.net/bigyanr/archive/tags/SQL/default.aspx" /><category term="LINQ" scheme="http://weblogs.asp.net/bigyanr/archive/tags/LINQ/default.aspx" /><category term="asp.net" scheme="http://weblogs.asp.net/bigyanr/archive/tags/asp.net/default.aspx" /><category term=".net" scheme="http://weblogs.asp.net/bigyanr/archive/tags/.net/default.aspx" /></entry><entry><title>Is VB.Net better or C#.net? Or is .Net a .Net either way?</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/bigyanr/archive/2008/02/07/is-vb-net-better-or-c-net-or-is-net-a-net-either-way.aspx" /><id>http://weblogs.asp.net/bigyanr/archive/2008/02/07/is-vb-net-better-or-c-net-or-is-net-a-net-either-way.aspx</id><published>2008-02-08T05:45:00Z</published><updated>2008-02-08T05:45:00Z</updated><content type="html">&lt;FONT size=3&gt;&lt;FONT face=Calibri&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;B style="mso-bidi-font-weight: normal"&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;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&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. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Here it goes; &lt;B style="mso-bidi-font-weight: normal"&gt;don’t forget to put in your two cents&lt;/B&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Calibri color=#17365d size=3&gt;Reasons to Choose C# over VB.NET:&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&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.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In fact, both Visual Studio and the .NET Framework where written in C# (using C++ as a backend).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Furthermore, C# was submitted to, and standardized by, the ECMA group as an open standard while VB remains proprietary.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&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.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;These similarities means a C# programmer will be more able to read...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A class="" title="Click Here to Read More..." href="http://www.dotnetlog.com/archive/2008/02/07/is-vb.net-better-or-c.net-or-is-.net-a-.net.aspx" mce_href="http://www.dotnetlog.com/archive/2008/02/07/is-vb.net-better-or-c.net-or-is-.net-a-.net.aspx"&gt;Click here to read more...&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5735359" width="1" height="1"&gt;</content><author><name>bigyanr</name><uri>http://weblogs.asp.net/members/bigyanr.aspx</uri></author><category term="Asp.net VB.Net C#.Net" scheme="http://weblogs.asp.net/bigyanr/archive/tags/Asp.net+VB.Net+C_23002E00_Net/default.aspx" /></entry><entry><title>Useful Utility functions in .Net a.k.a ‘Hidden Treasures’</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/bigyanr/archive/2007/10/17/useful-utility-functions-in-net-a-k-a-hidden-treasures.aspx" /><id>http://weblogs.asp.net/bigyanr/archive/2007/10/17/useful-utility-functions-in-net-a-k-a-hidden-treasures.aspx</id><published>2007-10-17T23:05:00Z</published><updated>2007-10-17T23:05:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;It’s no secret that Microsoft’s is releasing the source for some of its core .Net classes in upcoming visual studio 2008. Before that arrives, the option to look at some of core classes is probably the .Net Reflector. Every now and then, when I want to find out how Microsoft implemented some of the functionalities in core classes, or if I want to learn better way to program, I use the reflector to dig through the core components. During these adventures, I have bumped into various classes and functions, that I thought were just too cool, and also unfortunate that most were internal only. One of my favorites is the VirtualPath class. However, during this quest I have also found that in some way or other the framework team did expose some great utility functions. Most developers aren’t aware of this, including myself and make the mistake of rewriting it. Thus, here’s a shot at exposing some of the cool Utility Classes and Functions (I have been using) that every .Net developer should know. (I hope to keep adding to this list, if anyone has other suggestions please feel free to add.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A class="" href="http://www.dotnetlog.com/archive/2007/10/17/useful-utility-functions-in-.net-a.k.a-hidden-treasures.aspx" mce_href="http://www.dotnetlog.com/archive/2007/10/17/useful-utility-functions-in-.net-a.k.a-hidden-treasures.aspx"&gt;Read More&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4615197" width="1" height="1"&gt;</content><author><name>bigyanr</name><uri>http://weblogs.asp.net/members/bigyanr.aspx</uri></author><category term="Asp.Net Utility functions helper methods c#" scheme="http://weblogs.asp.net/bigyanr/archive/tags/Asp.Net+Utility+functions+helper+methods+c_2300_/default.aspx" /></entry><entry><title>Using non asp.net file extensions with asp.net</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/bigyanr/archive/2007/10/16/using-non-asp-net-file-extensions-with-asp-net.aspx" /><id>http://weblogs.asp.net/bigyanr/archive/2007/10/16/using-non-asp-net-file-extensions-with-asp-net.aspx</id><published>2007-10-16T12:49:00Z</published><updated>2007-10-16T12:49:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;As a developer it’s pretty interesting the type of things you run into. Well, couple weeks ago at work, I ran into a situation where I had to reverse engineer the webservice from php, however, still had to maintain the .php extension on the endpoint. In asp.net this is pretty easy to handle using handlers and build providers. Here’s how you can configure your asp.net so that it builds your .php file as if it were .asmx/.aspx. &lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;1. First of all, you’ll need to configure your IIS to handle requests to .php (.cfm/.jsp etc…) with aspnet_isapi. Browse to your virtual directory -&amp;gt;properties-&amp;gt;Configuration-&amp;gt;Add extension mapping. Configure it as show in the picture.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;A href="http://www.dotnetlog.com/archive/2007/10/15/using-non-asp.net-file-extensions-with-asp.net.aspx"&gt;&lt;FONT color=#800080&gt;Read More Here&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4590389" width="1" height="1"&gt;</content><author><name>bigyanr</name><uri>http://weblogs.asp.net/members/bigyanr.aspx</uri></author><category term="dotnetlog.com asp.net C# file extensions" scheme="http://weblogs.asp.net/bigyanr/archive/tags/dotnetlog.com+asp.net+C_2300_+file+extensions/default.aspx" /></entry></feed>