<?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>Amit Kulkarni's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/amitkulkarni/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/amitkulkarni/feed.xml</link>
    <description>Thoughts on Microsoft Dynamics AX</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:47:17 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Using separate user connection with UnitofWork</title>
      <link>https://docs.microsoft.com/archive/blogs/amitkulkarni/using-separate-user-connection-with-unitofwork</link>
      <pubDate>Tue, 30 Oct 2012 12:22:00 GMT</pubDate>
      <dc:creator><![CDATA[Amit R. Kulkarni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amitkulkarni/2012/10/30/using-separate-user-connection-with-unitofwork/</guid>
      <description><![CDATA[Unit of Work is a great capability in Microsoft Dynamics AX 2012 to reduce chattiness between AOS...]]></description>
      <content:encoded><![CDATA[<p><a href="https://msdn.microsoft.com/en-us/library/gg958246.aspx">Unit of Work</a> is a great capability in Microsoft Dynamics AX 2012 to reduce chattiness between AOS and SQL server. A high level overview of UoW is available in this informative blog post: <a title="https://dynamics-ax.blogspot.com/2011/07/microsoft-dynamics-ax-2012-unitofwork.html" href="https://dynamics-ax.blogspot.com/2011/07/microsoft-dynamics-ax-2012-unitofwork.html">https://dynamics-ax.blogspot.com/2011/07/microsoft-dynamics-ax-2012-unitofwork.html</a>.</p>
<p>One of the cool things about unit of work (UoW) is the capability to use a custom <a href="https://msdn.microsoft.com/en-us/library/userconnection.aspx">user connection</a>. If you would like a set of DML operations to be executed on a separate user connection then that is possible with UoW. If you have legacy code that uses RecordInsertList and want to use a custom user connection then you should rewrite the code using UoW.</p>
<p>Here is an example of how to use UoW with a custom user connection:</p>
<blockquote>
<p><span style="font-family: Courier New;" face="Courier New"><strong>static void UoWTest(Args _args) <br />{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; Table1 table1; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; // Define a new user connection <br />&nbsp;&nbsp;&nbsp; UserConnection uc= new UserConnection(); <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; // Define a new UoW <br />&nbsp;&nbsp;&nbsp; unitOfWork uofw = new UnitofWork();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; // Add a table buffer to insert on save changes in the UoW <br />&nbsp;&nbsp;&nbsp; table1.Field1 = 'foo'; <br />&nbsp;&nbsp;&nbsp; uofw.insertonSaveChanges(table1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; // Perform additional interactions that you&nbsp; <br />&nbsp;&nbsp;&nbsp; // want to club together with the UoW <br />&nbsp;&nbsp;&nbsp; // by calling insertonSaveChanges, updateonSaveChanges <br />&nbsp;&nbsp;&nbsp; // and deleteonSaveChanges&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; ...</strong></span></p>
<p><span style="font-family: Courier New;" face="Courier New"><strong>&nbsp;&nbsp;&nbsp; // Finally pass the user connection to <br />&nbsp;&nbsp;&nbsp; //the UoW to use on SaveChanges <br />&nbsp;&nbsp;&nbsp; uofw.saveChanges(uc); <br />}</strong></span></p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>Finding User Sessions from SPID in Dynamics AX 2012</title>
      <link>https://docs.microsoft.com/archive/blogs/amitkulkarni/finding-user-sessions-from-spid-in-dynamics-ax-2012</link>
      <pubDate>Wed, 10 Aug 2011 12:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Amit R. Kulkarni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amitkulkarni/2011/08/10/finding-user-sessions-from-spid-in-dynamics-ax-2012/</guid>
      <description><![CDATA[In previous versions of Dynamics AX, the &ldquo;Online Users&rdquo; form contained a column for SPID...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: x-small;" size="2">In previous versions of Dynamics AX, the &ldquo;Online Users&rdquo; form contained a column for SPID for each client sessions. This column was a useful tool in debugging blocked SPID. More specifically, it was used to find a user session that corresponded to a specific SPID as indicated in </span><a href="https://blogs.msdn.com/b/daxis/archive/2009/01/16/troubleshooting-blocked-spids-in-aos.aspx"><span style="font-size: x-small;" size="2">this blog post</span></a><span style="font-size: x-small;" size="2">. In Microsoft Dynamics AX 2012 the SPID column is no longer available on the &ldquo;Online Users&rdquo; form. This post will describe how to find the user session corresponding to a particular SPID.</span></p>
<p><span style="font-size: x-small;" size="2">In Dynamics AX 2012, information about the user sessions can be directly included in the SQL connection context. Adding&nbsp; this information has a small performance overhead. Therefore, it is not turned on by default. To include user session information in the connection context perform the following steps:</span></p>
<ol>
<li><span style="font-size: x-small;" size="2">Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Dynamics Server\6.0\01\Original (installed configuration). The last key, Original (installed configuration), is the key name for the current server configuration. If your system uses a different configuration that the original installed configuration, navigate to the currently active configuration.</span></li>
<li><span style="font-size: x-small;" size="2">Create a string registry value called &lsquo;connectioncontext&rsquo; and set the value to 1.</span></li>
<li><span style="font-size: x-small;" size="2">Restart the AOS.</span></li>
</ol>
<p><span style="font-size: x-small;" size="2">Next open SQL Server Management Studio and run the following query to look at all the sessions related to Microsoft Dynamics AX:</span></p>
<p><span style="font-size: x-small;" size="2"><strong>select cast(context_info as varchar(128)) as ci,* from sys.dm_exec_sessions where program_name like '%Dynamics%'</strong></span></p>
<p><span style="font-size: x-small;" size="2">Here&rsquo;s the sample output. Let&rsquo;s take a closer look at the ci column.</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/47/07/metablogapi/7802.image_6E4FEEFE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-07-metablogapi/7802.image_5F00_6E4FEEFE.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/47/07/metablogapi/6320.image_thumb_02D53E7D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-07-metablogapi/6320.image_5F00_thumb_5F00_02D53E7D.png" width="772" height="241" /></a></p>
<p><span style="font-size: x-small;" size="2">The first two items in the connection information are AX user id and the AX session id. So for SQL session_id 60 the user is &lsquo;Admin&rsquo; and AX session id is 3. Next we can open the &ldquo;Online Users&rdquo; form to find the user session associated with the SPID.</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/47/07/metablogapi/1122.image_429F2502.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-07-metablogapi/1122.image_5F00_429F2502.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/47/07/metablogapi/6835.image_thumb_6D778914.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-07-metablogapi/6835.image_5F00_thumb_5F00_6D778914.png" width="769" height="402" /></a></p>]]></content:encoded>
    </item>
  </channel>
</rss>