<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Florin Lazar - Consistency Checkpoint</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/florinlazar/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/florinlazar/feed.xml</link>
    <description>Make it simple, robust and scalable</description>
    <lastBuildDate>Fri, 26 Feb 2016 06:24:17 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>System.Transactions and Allow Inbound/Outbound DTC Settings</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/system-transactions-and-allow-inboundoutbound-dtc-settings</link>
      <pubDate>Thu, 24 Sep 2009 01:27:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2009/09/24/system-transactions-and-allow-inboundoutbound-dtc-settings/</guid>
      <description><![CDATA[If you do distributed transactions across the network, you know about Allow Inbound and Allow...]]></description>
      <content:encoded><![CDATA[<P>If you do distributed transactions across the network, you know about Allow Inbound and Allow Outbound security settings for DTC (available by running dcomcnfg or by opening Component Services).</P>
<P>The help describes these settings as:</P>
<UL>
<LI>Allow Inbound: Select this check box to allow a remote computer to flow transactions to the local computer. Typically, this option is needed on the computer that is hosting the DTC for a resource manager such as Microsoft SQL Server.</LI>
<LI>Allow Outbound: Select this check box to allow the local computer to flow transactions to a remote computer. Typically, this option is needed on the client computer, where the transaction is initiated.</LI></UL>
<P>Pretty straightforward: you set Allow Outbound on the client and Allow Inbound on the SQL Server box. Except, if you are using System.Transactions with SQL Server and you promote after the first connection to the database (which means DTC gets involved), the transaction will most likely abort. Why?</P>
<P>If you remember <A href="https://blogs.msdn.com/florinlazar/archive/2005/05/17/writing-a-resource-manager-that-supports-promotable-transactions-or-promotable-single-phase-enlistment-aka-pspe-in-system-transactions.aspx" target=_blank mce_href="https://blogs.msdn.com/florinlazar/archive/2005/05/17/writing-a-resource-manager-that-supports-promotable-transactions-or-promotable-single-phase-enlistment-aka-pspe-in-system-transactions.aspx">my previous post</A> on promotable transactions, in this case, the distributed transaction gets initiated on the resource manager (SQL Server) side and gets flown back to the client, which means that you actually need to set Allow Outbound on the SQL Server box and Allow Inbound on the client.</P>
<P>I know, it's not the most intuitive setting. Allow Inbound/Outbound were created before System.Transactions, they are still doing what they were designed to do, except that they didn't evolve with System.Transactions.</P>
<P>When System.Transactions was being designed, between other goals one important one was to make it easy to use. And with that, the promotion part was supposed to be as invisible as possible - things will go fast, then on demand promote to DTC and continue without any user intervention. The legacy of managing DTC network settings couldn't be avoided and thus all these details had to be explained.<BR></P>]]></content:encoded>
    </item>
    <item>
      <title>Intro for Microsoft Azure .Net Service Bus</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/intro-for-microsoft-azure-net-service-bus</link>
      <pubDate>Thu, 02 Apr 2009 22:10:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2009/04/02/intro-for-microsoft-azure-net-service-bus/</guid>
      <description><![CDATA[Clemens Vasters gives a great introduction to Microsoft Azure .Net Service Bus and its 4 feature...]]></description>
      <content:encoded><![CDATA[<P>Clemens Vasters gives a great introduction to Microsoft Azure .Net Service Bus and its 4 feature areas: Naming, Registry, Connectivity, and Eventing.&nbsp;Find it at&nbsp;<A href="https://vasters.com/clemensv/PermaLink,guid,92d78bee-2cfd-4a29-95ab-c5abb9b905e7.aspx" mce_href="https://vasters.com/clemensv/PermaLink,guid,92d78bee-2cfd-4a29-95ab-c5abb9b905e7.aspx">https://vasters.com/clemensv/PermaLink,guid,92d78bee-2cfd-4a29-95ab-c5abb9b905e7.aspx</A></P>]]></content:encoded>
    </item>
    <item>
      <title>Atbroker.exe application error - CTRL-ALT-END in a remote session</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/atbroker-exe-application-error-ctrl-alt-end-in-a-remote-session</link>
      <pubDate>Tue, 25 Nov 2008 20:20:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/11/25/atbroker-exe-application-error-ctrl-alt-end-in-a-remote-session/</guid>
      <description><![CDATA[I use remote desktop daily. The Atbroker.exe application error followed by black screen seemed to be...]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'"><FONT size=3><FONT face=Calibri>I use remote desktop daily. The Atbroker.exe application error followed by black screen seemed to be gone for a while. Now it is back. The only solution that I know of and which works most of the times is "CTRL-ALT-END" (the equivalent of “CTRL-ALT-DEL” for remote sessions) followed by ESC. When it doesn’t work, I need to log in with another user and kill the session with the issue or reboot the box – nasty.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>When not to use transactions and where you can't use transactions</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/when-not-to-use-transactions-and-where-you-cant-use-transactions</link>
      <pubDate>Thu, 08 May 2008 18:21:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/05/08/when-not-to-use-transactions-and-where-you-cant-use-transactions/</guid>
      <description><![CDATA[Transactions are great when everyone plays in. You group a set of activities together under a...]]></description>
      <content:encoded><![CDATA[<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Transactions are great when everyone plays in. You group a set of activities together under a transaction and you start executing them. If anything bad happens along the way or something doesn't go as planned, invoke rollback and all is taking care of automatically by the infrastructure: everything is undone and the app returns to the state before the transaction started; recovery and consistency is a piece of cake with nothing to worry about.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">But...<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">I can't really use transactions for long running sequences of activities. I mean, technically is possible, but the app will not scale anymore. Imagine starting the transaction today, updating databases and doing transactional work for a few days; add to that a few human interventions (when user input is required) and make it a few more days longer and only after that commit the transaction. What just happened? For those number of days, the transactional work kept all the resources that it touched in a locked state waiting for the commit (or rollback) decision. All these resources could not be used by anybody else (with various degrees of freedom depending on your isolation level) for that many days. Transactions are really meant for short lived work.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Another aspect, partial rollback - the ability to rollback some work in the case of an event, but let the rest of the work that executed so far to continue towards a possible commit. This is not possible today with how transactions are implemented: have at least one little piece of work or resource declare itself in error and the whole transaction will rollback, no exceptions allowed.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">And then, maybe the most major aspect, not everything participates in a transaction. It can be a resource, it can be an action that can't rollback. Implementing resources that are transactional is not trivial, meeting all the ACID properties is hard. Or in some cases, it just doesn't make sense to make something transactional, like sending an email. What to rollback there?. Chase the internet to catch the email before it reaches ones inbox, and if it got to the inbox, tell the reader to forget it? <o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">In all these cases, something else needs to be used in combination with short lived transactions. That means that you need to provide code that un-does/cancels/compensates the work that was already done. You need to write most of the "undo" code since the rules need to be more relaxed than with transactions. The compensation logic varies depending on the application logic at that given time. In the transactions world, the ACID requirements govern everything and there are always only two states: an initial state before transaction and a state after the transaction commits; rollback will always move the app back to the initial state. With compensation, the number of consistency states depends on the app and are defined by the app.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Support for compensation exists today in Biztalk Server and Windows Workflow. </SPAN>]]></content:encoded>
    </item>
    <item>
      <title>MSDTC and COM+ Configuration Tool in Vista</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/msdtc-and-com-configuration-tool-in-vista</link>
      <pubDate>Wed, 07 May 2008 18:01:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/05/07/msdtc-and-com-configuration-tool-in-vista/</guid>
      <description><![CDATA[To access the MSDTC and COM+ configuration tool in Windows Vista, also known as Component Services...]]></description>
      <content:encoded><![CDATA[<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">To access the MSDTC and COM+ configuration tool in Windows Vista, also known as Component Services MMC, you have the following options:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Run “dcomcnfg”<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Or run: %SystemRoot%\System32\comexp.msc<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Or if you prefer, you can add a shortcut to %SystemRoot%\System32\comexp.msc in Control Panel<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">If you have UAC on and you want to do 3, first make a shortcut for %SystemRoot%\System32\comexp.msc on your Desktop and then move it to Control Panel.<o:p></o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Exception Handling without catch(Exception)</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/exception-handling-without-catchexception</link>
      <pubDate>Wed, 07 May 2008 02:58:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/05/07/exception-handling-without-catchexception/</guid>
      <description><![CDATA[The design guidelines for exception handling are quite clear on avoiding “catch all” and/or avoiding...]]></description>
      <content:encoded><![CDATA[<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">The <A href="https://msdn.microsoft.com/en-us/library/ms229005.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms229005.aspx">design guidelines for exception handling</A> are quite clear on avoiding “catch all” and/or avoiding catching exceptions you can’t handle. But there are cases when you really need to know if the <I style="mso-bidi-font-style: normal">try</I> block completed successfully or not, and possibly take some action.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">One way one could achieve this without breaking the guideline is to set a flag at the end of the <I style="mso-bidi-font-style: normal">try</I> block and then query it inside <I style="mso-bidi-font-style: normal">finally</I>:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">bool</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> workCompleted = <SPAN style="COLOR: blue">false</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">try<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>DoSomething();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>DoSomethingMore();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>workCompleted = <SPAN style="COLOR: blue">true</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">finally<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (!workCompleted)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: #a31515">"record that the work failed"</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Working with CMD and Long Path Names</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/working-with-cmd-and-long-path-names</link>
      <pubDate>Tue, 06 May 2008 15:54:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/05/06/working-with-cmd-and-long-path-names/</guid>
      <description><![CDATA[I like using the command prompt for a lot of things and working with long (or very long) path names...]]></description>
      <content:encoded><![CDATA[<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">I like using the command prompt for a lot of things and working with long (or very long) path names is something that is common these days.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Fortunately, you can customize cmd by using "prompt". Do a “prompt /?” in a command window <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>to see all the options.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">I like it simple and I use: “PROMPT=$p$_$+$g”. This gives:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt"><FONT face=Consolas>C:\Windows\System32\Msdtc\Trace<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt"><FONT face=Consolas>&gt;<o:p>&nbsp;</o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">To persist it, set it as an environment variable.<o:p></o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>How to Use System.Data with System.Transactions and Maintain Atomicity and Data Consistency</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/how-to-use-system-data-with-system-transactions-and-maintain-atomicity-and-data-consistency</link>
      <pubDate>Mon, 05 May 2008 06:04:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/05/05/how-to-use-system-data-with-system-transactions-and-maintain-atomicity-and-data-consistency/</guid>
      <description><![CDATA[The Bug
I call it a bug. Initially I was persuaded to believe it was a feature; later I was...]]></description>
      <content:encoded><![CDATA[<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Consolas>The Bug<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></B></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">I call it a bug. Initially I was persuaded to believe it was a feature; later I was "convinced" that it is now a matter of app compat and it can't be changed anymore.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Let’s look at the following code:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Consolas size=3>&nbsp;</FONT></o:p></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>SqlConnection connection1 = new SqlConnection(connectionString);<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>using(TransactionScope txScope = new TransactionScope())<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>connection1.Open();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>SqlCommand command1 = new SqlCommand(commandString1, connection1);<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>command1.ExecuteNonQuery();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>SqlCommand command2 = new SqlCommand(commandString2, connection1);<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>command2.ExecuteNonQuery();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>txScope.Complete();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>}<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT face=Consolas><SPAN style="FONT-SIZE: 10pt; COLOR: #002060">…</SPAN><SPAN style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">What are your expectations from this code? I’m sure you are saying that both commands will execute with success or none will execute, for instance if command1 succeeds and command2 fails and throws, the transaction rollbacks and command1 is undone. Right?<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Let’s add more data to the equation: transactions can abort at any time due to various reasons, most common one being timeouts. Let’s imagine that the transaction timeout is 30 seconds. Then, let’s imagine that command1 takes 29.(9) seconds to execute. This means that the transaction aborts immediately after that. Let’s imagine that it aborts before command2 starts executing. Now, what are the expectations here? Well, transaction aborts and then command1 is undone and everything goes back to the state before the transaction was started. <o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Unfortunately, by using the defaults for System.Data this is not what happens. What really happens is:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore">-<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">command1 is undone<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore">-<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">command2 is executed outside the transaction<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">There is no typo there, command2 executes even if the transaction aborted. In other words, if one expected atomicity for the code inside TransactionScope, the code just corrupted the data due to the partial rollback.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">The “Feature”<o:p></o:p></SPAN></B></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>Apparently the following code is common:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>SqlConnection connection1 = new SqlConnection(connectionString);<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>using(TransactionScope txScope = new TransactionScope())<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>connection1.Open();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>SqlCommand command1 = new SqlCommand(commandString1, connection1);<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>command1.ExecuteNonQuery();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>SqlCommand command2 = new SqlCommand(commandString2, connection1);<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>command2.ExecuteNonQuery();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>txScope.Complete();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>}<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-SIZE: 10pt; COLOR: #002060"><FONT face=Consolas>SqlCommand command3 = new SqlCommand(commandString3, connection1);<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT face=Consolas><SPAN style="FONT-SIZE: 10pt; COLOR: #002060">command3.ExecuteNonQuery();</SPAN><SPAN style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt"><o:p><FONT face=Consolas>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">In other words, the “feature” allows the use of the connection in auto-commit mode after it was previously used in a transaction. The connection automatically unbinds from the transaction when the transaction completes (either abort or commit) and becomes an auto-commit non-transacted connection.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">The App Compat Issue<o:p></o:p></SPAN></B></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Now that we know that the automatic unbind can lead to data corruption, changing it to not unbind automatically will make the code for command3 to fail to execute, since the connection1 is trying to run a command in a transaction that completed. Thus, if the code is indeed common, changing the behavior of the connection will indeed break existing apps.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">The Solution<o:p></o:p></SPAN></B></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">The solution implemented by System.Data in “Orcas” is to pass a new keyword to the connection string called “Transaction Binding” and give it the value of “Explicit Binding” to disable the auto-unbind. This will cause command2 to try to execute under the same transaction as command1, even after the abort occurred. See <A href="https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx">ConnectionString</A> and <A href="https://msdn.microsoft.com/en-us/library/ms172070.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms172070.aspx">Integration with Transactions</A>&nbsp;for details.<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">The following thread might also be useful: <A href="https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3055387&amp;SiteID=1" mce_href="https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3055387&amp;SiteID=1">https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3055387&amp;SiteID=1</A><o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>Hopefully, the default behavior will change to explicit unbind in the future releases (non-SP)&nbsp;of .Net Framework.</o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Limitation of TransactionScope (and using)</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/limitation-of-transactionscope-and-using</link>
      <pubDate>Mon, 05 May 2008 04:38:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/05/05/limitation-of-transactionscope-and-using/</guid>
      <description><![CDATA[If you read the documentation for TransactionScope, you will find: "If no exception occurs within...]]></description>
      <content:encoded><![CDATA[<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">If you read the documentation for <A href="https://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx">TransactionScope</A>, you will find: "If no exception occurs within the transaction scope […], then the transaction in which the scope participates is allowed to proceed. <I style="mso-bidi-font-style: normal">If an exception does occur within the transaction scope, the transaction in which it participates will be rolled back.</I>" Later the doc says: “When your application completes all work it wants to perform in a transaction, <I style="mso-bidi-font-style: normal">you should call the <A id=ctl00_rs1_mainContentContainer_ctl44 href="https://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.complete.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.complete.aspx"><SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none">Complete</SPAN></A> method only once to inform that transaction manager that it is acceptable to commit the transaction</I>. Failing to call this method aborts the transaction.”<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Consolas size=3>&nbsp;</FONT></o:p></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">OK, so how about this code:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Consolas size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">(<SPAN style="COLOR: #2b91af">TransactionScope</SPAN> ts = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">TransactionScope</SPAN>(<SPAN style="COLOR: #2b91af">TransactionScopeOption</SPAN>.RequiresNew)) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// do transactional work<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ts.Complete();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Exception</SPAN>();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Consolas size=3>&nbsp;</FONT></o:p></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">What happens to the transaction after executing this code? Take a guess. If we follow the doc, the transaction roll backs, right? Well, the transaction actually commits – try it out!<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Consolas size=3>&nbsp;</FONT></o:p></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">Let’s see what happens by “unpacking” the <I style="mso-bidi-font-style: normal">using</I> statement:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face=Consolas><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">TransactionScope</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> ts = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">TransactionScope</SPAN>(<SPAN style="COLOR: #2b91af">TransactionScopeOption</SPAN>.RequiresNew);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">try </SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// do transactional work</SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="COLOR: green"><o:p></o:p></SPAN></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ts.Complete();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Exception</SPAN>();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">finally </SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ts.Dispose();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Consolas size=3>&nbsp;</FONT></o:p></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">In the Dispose of TransactionScope something similar to the following pseudo-code happens:<o:p></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt"><FONT face=Consolas><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if Complete was called {<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt"><FONT face=Consolas><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Transaction.Commit();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"><SPAN style="FONT-SIZE: 10pt"><FONT face=Consolas>}<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"><SPAN style="FONT-SIZE: 10pt"><FONT face=Consolas>else {<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"><SPAN style="FONT-SIZE: 10pt"><FONT face=Consolas><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Transaction.Rollback();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"><FONT face=Consolas><SPAN style="FONT-SIZE: 10pt">}</SPAN><BR><FONT size=3><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">The limitation really comes from the fact that at Dispose time in finally, the <I style="mso-bidi-font-style: normal">using</I> construct doesn’t offer any information about completion of its body with exception or not. That is why the Transaction.Complete was invented and that is why the documentation for <A href="https://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.complete.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.complete.aspx">Complete</A> says: “It is very good practice to put the call as the last statement in the <B>using</B> block.” Complete was invented to detect exceptions, i.e. if an exception occurs, Complete will not get called – but this work only if one follows the guideline to put Complete as the last statement.&nbsp;Doing any work after Complete was called is&nbsp;asking for trouble and possible data corruption.&nbsp;</SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin">If you want to be on the safe side, use my <I style="mso-bidi-font-style: normal"><A href="https://blogs.msdn.com/florinlazar/archive/2008/03/24/8334137.aspx" mce_href="https://blogs.msdn.com/florinlazar/archive/2008/03/24/8334137.aspx">transacted</A></I> construct which doesn’t have these issues. It follows a simple rule: if an exception is thrown, the transaction aborts, otherwise it commits.<o:p></o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Avoiding Transaction Promotion with Multiple Connections - Improvements in System.Data and SQL Server 2008</title>
      <link>https://docs.microsoft.com/archive/blogs/florinlazar/avoiding-transaction-promotion-with-multiple-connections-improvements-in-system-data-and-sql-server-2008</link>
      <pubDate>Fri, 02 May 2008 19:02:00 GMT</pubDate>
      <dc:creator><![CDATA[florinlazar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/florinlazar/2008/05/02/avoiding-transaction-promotion-with-multiple-connections-improvements-in-system-data-and-sql-server-2008/</guid>
      <description><![CDATA[Great news! The new updates added to System.Data and SQL Server 2008 finally allow multiple...]]></description>
      <content:encoded><![CDATA[<P>Great news! The new updates added to System.Data and SQL Server 2008 finally allow multiple Open/Close connections to the same SQL Server without promoting the transaction to MSDTC.</P>
<P>This was by far the most requested feature for the System.Transactions/System.Data/SQL Server combination.</P>
<P>There is no more the need to write workarounds like <A class="" href="https://blogs.msdn.com/dataaccess/archive/2006/02/14/532026.aspx" mce_href="https://blogs.msdn.com/dataaccess/archive/2006/02/14/532026.aspx">ConnectionScope</A> to avoid promotions.</P>
<P>Now&nbsp;I can write as many Open/Close, Open/Close as I need to, without worrying about promotion:</P><PRE class=csharpcode>transacted(()=&gt;
{
   using (SqlConnection connection1 = new SqlConnection(connectionString))
   {
      Connection1.Open();

      SqlCommand command1 = new SqlCommand(commandString1, connection1);
      command1.ExecuteNonQuery();

      SqlCommand command2 = new SqlCommand(commandString2, connection1);
      command2.ExecuteNonQuery();

      connection1.Close();
   }

   ...

   using (SqlConnection connection2 = new SqlConnection(connectionString))
   {
      Connection2.Open();

      SqlCommand command1 = new SqlCommand(commandString1, connection2);
      command1.ExecuteNonQuery();

      SqlCommand command2 = new SqlCommand(commandString2, connection2);
      command2.ExecuteNonQuery();

      connection2.Close();
   }
});
</PRE>
<P>More details on the updates at the <A class="" href="https://blogs.msdn.com/adonet/archive/2008/03/26/extending-lightweight-transactions-in-sqlclient.aspx" mce_href="https://blogs.msdn.com/adonet/archive/2008/03/26/extending-lightweight-transactions-in-sqlclient.aspx">ADO.Net team blog</A>.</P>]]></content:encoded>
    </item>
  </channel>
</rss>