<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Axilicious</title>
	<atom:link href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog</link>
	<description>Dynamics Ax Technical blog</description>
	<lastBuildDate>Mon, 23 Apr 2012 22:13:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Ax 2012 and ETW (Event Tracing for Windows)</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/04/ax-2012-and-etw-event-tracing-for-windows/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/04/ax-2012-and-etw-event-tracing-for-windows/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 22:13:12 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[Dynamics Ax]]></category>
		<category><![CDATA[Dynamics AX 2012]]></category>
		<category><![CDATA[ETW]]></category>
		<category><![CDATA[Tracing]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=539</guid>
		<description><![CDATA[Now let&#8217;s get into to business quick and start off with a question : &#8220;How often did you want to reproduce / debug a certain process without actually knowing where the source of the problem may reside?&#8221; Well the answer to that question for most of us will be : &#8220;Quite a lot&#8221; and then [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/04/ax-2012-and-etw-event-tracing-for-windows/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/04/ax-2012-and-etw-event-tracing-for-windows/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Now let&#8217;s get into to business quick and start off with a question : &#8220;How often did you want to reproduce / debug a certain process without actually knowing where the source of the problem may reside?&#8221;</p>
<p>Well the answer to that question for most of us will be : &#8220;Quite a lot&#8221; and then this would be followed immediately with the question : &#8220;Did you then create data log tables to store values, stack traces, information messages, &#8230;?&#8221; And again the answer will be often : &#8220;Yes&#8221;</p>
<p>Now this will probably help you out : ETW!</p>
<p>I will not go into the full details of Event Tracing for Windows as this would definately take us too far, but here&#8217;s a link where you can do some additional reading : http://msdn.microsoft.com/en-us/library/windows/desktop/bb968803(v=vs.85).aspx</p>
<p>What we will look at for this post is how we can make advantage of ETW to do some tracing within Dynamics Ax 2012. Specifically we are going to make a custom piece of code do output some informational messages that can be caught by a data collector set using Perfmon and viewed by the Event viewer.</p>
<p>The following question may arise : &#8220;Why would we want ETW to handle the tracing and not stay in our habitat of X++ and storing data in tables?&#8221; Well the answer to this is:</p>
<ul>
<li>ETW by far does not cause as many overhead as normal logging would do. Both for execution time (CPU) and diskspace.</li>
<li>If your code is ETW ready, you can do logging in production environments by starting / stopping data collector sets.</li>
<li>If your code is ETW ready, logging does not need to be built when needed but will immediately be available when needed.</li>
<li>The log files can be used in Event Viewers and also SCOM so it helps system administrators to know what is going on in the black box Dynamics Ax.</li>
</ul>
<p>So let us jump in and create the data collector set.</p>
<p>First start op by opening perfmon and navigate to the user defined data collector sets.</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/Perfmon.png"><img class="aligncenter size-medium wp-image-544" title="Perfmon" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/Perfmon-300x214.png" alt="" width="300" height="214" /></a></p>
<p>Right click and create a new data collector set.</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreateDataCollector1.png"><img class="aligncenter size-full wp-image-540" title="CreateDataCollector1" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreateDataCollector1.png" alt="" width="549" height="424" /></a></p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreateDataCollector2.png"><img class="aligncenter size-full wp-image-541" title="CreateDataCollector2" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreateDataCollector2.png" alt="" width="549" height="424" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreatingDataCollector3.png"><img class="aligncenter  wp-image-542" title="CreatingDataCollector3" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreatingDataCollector3.png" alt="" width="741" height="466" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreatingDataCollector4.png"><img class="aligncenter  wp-image-543" title="CreatingDataCollector4" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/CreatingDataCollector4.png" alt="" width="776" height="425" /></a></p>
<p>After the creation of the data collector set, right click it and you can start / stop the collection of ETW events.</p>
<p>But now that we have the collection part, we also need to make custom code trigger some events from within Dynamics Ax. And that is where the <strong>xClassTrace</strong>  class comes into play. The xClassTrace class is used to make advantage of ETW and is used to start / stop traces to files, log component messages in ETW to be caught by data collector sets, &#8230;</p>
<p>So let us take a look at some sample code that loops all customers and logs a component message in ETW to be caught. (Please not the isTracingEnabled checks to make sure string formatting will only be done when needed to have the minimum amount of performance overhead)</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> KeSae_ETW_LogComponentMessageTest<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    CustTable   theCustomer;
    ;
&nbsp;
    <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>xClassTrace<span style="color: #00007f;">::</span><span style="color: #000000;">isTracingEnabled</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        xClassTrace<span style="color: #00007f;">::</span><span style="color: #000000;">logComponentMessage</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'AxTracing'</span><span style="color: #00007f;">,</span><span style="color: #ff0000;">&quot;Starting ETW tracing&quot;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">while</span> <span style="color: #0000ff;">select</span> theCustomer
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>xClassTrace<span style="color: #00007f;">::</span><span style="color: #000000;">isTracingEnabled</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            xClassTrace<span style="color: #00007f;">::</span><span style="color: #000000;">logComponentMessage</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'AxTracing'</span><span style="color: #00007f;">,</span><span style="color: #0000ff;">strFmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Processing customer %1&quot;</span><span style="color: #00007f;">,</span> theCustomer.<span style="color: #000000;">AccountNum</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>xClassTrace<span style="color: #00007f;">::</span><span style="color: #000000;">isTracingEnabled</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        xClassTrace<span style="color: #00007f;">::</span><span style="color: #000000;">logComponentMessage</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'AxTracing'</span><span style="color: #00007f;">,</span><span style="color: #ff0000;">&quot;Starting ETW tracing&quot;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now that our code is ready to log some messages, start the data collector set in the perfmon tool and run the sample code. After running the code, go ahead and stop the data collector set. The result will be a log file generated that can be openened by the Event Viewer as seen below where we can actually see the logged messages from within Dynamics Ax.</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/TraceResult1.png"><img class="aligncenter  wp-image-545" title="TraceResult1" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/TraceResult1-1024x669.png" alt="" width="801" height="584" /></a></p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/TraceResult21.png"><img class="aligncenter  wp-image-549" title="TraceResult2" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/04/TraceResult21-1024x667.png" alt="" width="763" height="553" /></a></p>
<p>So this is a very simple example, but this logging method is the way to go when you want efficient, performing logging in your system! This way you can minimize the logging overhead.</p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/04/ax-2012-and-etw-event-tracing-for-windows/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/04/ax-2012-and-etw-event-tracing-for-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Business Operation Framework and multi-threading</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/02/business-operation-framework-and-multi-threading/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/02/business-operation-framework-and-multi-threading/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 01:14:11 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[Dynamics Ax]]></category>
		<category><![CDATA[AX 2012]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[Business Operation Framework]]></category>
		<category><![CDATA[Multi]]></category>
		<category><![CDATA[Thread]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=515</guid>
		<description><![CDATA[Some of you will be familiar enough with Ax 2009 and therefore know how to create multiple threads when running batch jobs. For those of you who aren&#8217;t : no worries! Since most of it will be done in the same way as before, you will be up to speed in no time. The main [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/02/business-operation-framework-and-multi-threading/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/02/business-operation-framework-and-multi-threading/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Some of you will be familiar enough with Ax 2009 and therefore know how to create multiple threads when running batch jobs.<br />
For those of you who aren&#8217;t : no worries! Since most of it will be done in the same way as before, you will be up to speed in no time.</p>
<p>The main difference in Ax 2012 is the Business Operation Framework that renders the RunBaseBatch framework kinda obsolete. (Read : It&#8217;s MS best practice to use BOF instead of RunBaseBatch). The BOF lets you create services and run these services in CIL. I will spare you the full details about CIL as it out of the scope of this article. You can find all the details about creating these services in some very nice posts of a colleague of mine.</p>
<ul>
<li><a href="http://www.artofcreation.be/2011/08/22/ax2012-sysoperation-part-1-data-contracts-and-service-operations/">Part 1 : Data contract and operations</a></li>
<li><a href="http://www.artofcreation.be/2011/08/23/ax2012-sysoperation-part-2-sysoperationservicecontroller/">Part 2 : SysOperationServiceController</a></li>
<li><a href="http://www.artofcreation.be/2011/08/24/ax2012-sysoperation-part-3-sysoperationautomaticuibuilder/">Part 3 : SysOperationAutomaticsUiBuilder</a></li>
</ul>
<p>Now that you have seen the basics, let&#8217;s get to the point of this article. Today we were wondering if the new BOF would also be able to handle multi-threaded batch processing and escpecially how it would be accomplished. Well here&#8217;s how…</p>
<p>In this example I will use a rather useless functionality but it&#8217;s done like this to keep things simple. I will have a set with some names in it and instead of running a service to display them all we will create two services :</p>
<ul>
<li>The <strong>KeSaeBatchService</strong> will be used to run the batch job with and devide the work into smaller threads</li>
<li>The <strong>KeSaeRunTaskService</strong> will act as one of those threads running in batch</li>
</ul>
<h4>Creating the run task service</h4>
<p>First thing to do is creating the KeSaeRunTaskService and creating a datacontract for it to contain a name it will be passed as a parameter. So start by creating the data contract.</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>DataContractAttribute<span style="color: #000000;">&#93;</span>
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> KeSaeRunTaskDataContract
<span style="color: #000000;">&#123;</span>
    Name mName;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#91;</span>DataMemberAttribute<span style="color: #000000;">&#93;</span>
<span style="color: #0000ff;">public</span> Name parmName<span style="color: #000000;">&#40;</span>Name _name <span style="color: #00007f;">=</span> mName<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    mName <span style="color: #00007f;">=</span> _name;
    <span style="color: #0000ff;">return</span> mName;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now that we have the contract, let&#8217;s create the <strong>service class</strong>. The service class just contains one method &#8216;<strong>process</strong>&#8216; that will be passed a data contract.</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> KeSaeRunTaskService
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#91;</span>SysEntryPointAttribute<span style="color: #000000;">&#93;</span>
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> process<span style="color: #000000;">&#40;</span>KeSaeRunTaskDataContract _theContract<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    <span style="color: #007f00;">// Inside the runTimeTask we just print the name passed</span>
    info<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">strFmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'%1'</span><span style="color: #00007f;">,</span> _theContract.<span style="color: #000000;">parmName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now create a service within the AOT and add the operation as seen below.</p>
<p><img src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/02/022512_0114_BusinessOpe1.png" alt="" /></p>
<h4>Creating the batch operation service</h4>
<p>Now let&#8217;s do the same thing all over again, but for the service that will be submitted to the batch framework.<br />
The only additional thing here is to create a menu item to that service to be able to run it.</p>
<p><img src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/02/022512_0114_BusinessOpe2.png" alt="" /></p>
<p>And last but not least we need to put in some code in the batch service to create smaller runTimeTasks when processing in batch so let&#8217;s take a look at the process method.</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>SysEntryPointAttribute<span style="color: #000000;">&#93;</span>
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> process<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    Set             theNames <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> Set<span style="color: #000000;">&#40;</span>Types<span style="color: #00007f;">::</span><span style="color: #000000;">String</span><span style="color: #000000;">&#41;</span>;
    SetEnumerator   theEnum;
    Name            theName;
    ;
&nbsp;
    <span style="color: #007f00;">// Add some names to the set to process</span>
    theNames.<span style="color: #000000;">add</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'Kenny'</span><span style="color: #000000;">&#41;</span>;
    theNames.<span style="color: #000000;">add</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'Klaas'</span><span style="color: #000000;">&#41;</span>;
    theNames.<span style="color: #000000;">add</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'Kevin'</span><span style="color: #000000;">&#41;</span>;
    theNames.<span style="color: #000000;">add</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'Tom'</span><span style="color: #000000;">&#41;</span>;
    theNames.<span style="color: #000000;">add</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'Ronald'</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #007f00;">// Create the enumerator</span>
    theEnum <span style="color: #00007f;">=</span> theNames.<span style="color: #000000;">getEnumerator</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #007f00;">// Loop all the names</span>
    <span style="color: #0000ff;">while</span> <span style="color: #000000;">&#40;</span>theEnum.<span style="color: #000000;">moveNext</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #007f00;">// Get the next name</span>
        theName <span style="color: #00007f;">=</span> theEnum.<span style="color: #000000;">current</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
        <span style="color: #007f00;">// Create a service controller to run the task for processing one name</span>
        mController <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> SysOperationServiceController<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">classStr</span><span style="color: #000000;">&#40;</span>KeSaeRunTaskService<span style="color: #000000;">&#41;</span><span style="color: #00007f;">,</span> <span style="color: #0000ff;">methodStr</span><span style="color: #000000;">&#40;</span>KeSaeRunTaskService<span style="color: #00007f;">,</span> process<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
        <span style="color: #007f00;">// Fetch the data contract from within the controller</span>
        mContract <span style="color: #00007f;">=</span> mController.<span style="color: #000000;">getDataContractObject</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'_theContract'</span><span style="color: #000000;">&#41;</span>;
&nbsp;
        <span style="color: #007f00;">// Put the current name in the controller's data contract</span>
        mContract.<span style="color: #000000;">parmName</span><span style="color: #000000;">&#40;</span>theName<span style="color: #000000;">&#41;</span>;
&nbsp;
        <span style="color: #007f00;">// Check if we are batch processing or not</span>
        <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>this.<span style="color: #000000;">isExecutingInBatch</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span><span style="color: #00007f;">!</span>mBatchHeader<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                mBatchHeader <span style="color: #00007f;">=</span> BatchHeader<span style="color: #00007f;">::</span><span style="color: #000000;">getCurrentBatchHeader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #007f00;">// Create a runTimeTask within the current batch job</span>
            mBatchHeader.<span style="color: #000000;">addRuntimeTask</span><span style="color: #000000;">&#40;</span>mController<span style="color: #00007f;">,</span> this.<span style="color: #000000;">getCurrentBatchTask</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">RecId</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0000ff;">else</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #007f00;">// Just run it immediately</span>
            mController.<span style="color: #000000;">run</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #007f00;">// If we're processing in batch, then save the batch header</span>
    <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>mBatchHeader<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        mBatchHeader.<span style="color: #000000;">save</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>This piece of code differs from Ax 2009 by constructing a SysOperationServiceController instead of a RunBaseBatch class to add as a runTimeTask. This works because the <strong>SysOperationServiceController</strong> <strong>extends</strong> the <strong>SysOperationController</strong> which in it&#8217;s turn implements <strong>Batchable.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> SysOperationServiceController <span style="color: #0000ff;">extends</span> SysOperationController
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">abstract</span> <span style="color: #0000ff;">class</span> SysOperationController <span style="color: #0000ff;">extends</span> Object <span style="color: #0000ff;">implements</span> Batchable</pre></div></div>

<p>That&#8217;s about it! Do not forget to compile CIL! Then you should be seeing this when your service is being processed in batch.</p>
<p><img src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/02/022512_0114_BusinessOpe3.png" alt="" /></p>
<p>And when clicking the parameters button on one of the threads, you can see the name that was passed in the data contract to the thread.</p>
<p><img src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2012/02/022512_0114_BusinessOpe4.png" alt="" /></p>
<p>All this can be found in an XPO file available <a href="http://www.ksaelen.be/DynamicsAxXpo/PrivateProject_KeSaeBOFMulti.xpo">here</a>.</p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/02/business-operation-framework-and-multi-threading/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2012/02/business-operation-framework-and-multi-threading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SysOperationFramework : Field display order</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/12/sysoperationframework-field-display-order/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/12/sysoperationframework-field-display-order/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 14:59:32 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[Dynamics Ax]]></category>
		<category><![CDATA[AX 2012]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[SysOperationDisplayOrderAttribute]]></category>
		<category><![CDATA[SysOperationFramework]]></category>
		<category><![CDATA[SysOperationGroupAttribute]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=428</guid>
		<description><![CDATA[Since the arrival of Dynamics Ax 2012, the traditional RunBaseBatch framework is getting obsolete. This has been replaced by the SysOperationFramework. This framework brings a few nice features that were missing in the RunBaseBatch framework. One them is the MVC pattern to separate concerns. The basics I would like to start with a few links [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/12/sysoperationframework-field-display-order/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/12/sysoperationframework-field-display-order/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Since the arrival of Dynamics Ax 2012, the traditional RunBaseBatch framework is getting obsolete. This has been replaced by the SysOperationFramework. This framework brings a few nice features that were missing in the RunBaseBatch framework. One them is the MVC pattern to separate concerns.</p>
<h4>The basics</h4>
<p>I would like to start with a few links concerning how to create SysOperationFramework services. A colleague of mine, Klaas Deforce, has created some posts that clearly explain how it works.</p>
<p>All of the post are linked through this overview post : <a href="http://www.artofcreation.be/2011/08/21/ax2012-sysoperation-introduction/">http://www.artofcreation.be/2011/08/21/ax2012-sysoperation-introduction/</a></p>
<h4>Field display order</h4>
<p>Well now, let&#8217;s come to the question of this post : How can you determine the sequence of dialog fields on the dialogs created by the SysOperationFramework? The answer here lies in the Attributes available also in Dynamics Ax 2012. You have a contract with several datamembers marked with the [DataMemberAttribute] attribute. To determine the sequence you can add the [SysOperationDisplayOrderAttribute] attribute (http://msdn.microsoft.com/en-us/library/gg963068.aspx).</p>
<p>For an example of this, you can check the AssetBalanceReportColumnsContract class, method parmAssetBookId.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>
    DataMemberAttribute<span style="color: #008000;">&#40;</span><span style="color: #666666;">'AssetBookId'</span><span style="color: #008000;">&#41;</span>,
    SysOperationGroupMemberAttribute<span style="color: #008000;">&#40;</span><span style="color: #666666;">'Book'</span><span style="color: #008000;">&#41;</span>,
    SysOperationDisplayOrderAttribute<span style="color: #008000;">&#40;</span><span style="color: #666666;">'1'</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> AssetBookMergeId parmAssetBookId<span style="color: #008000;">&#40;</span>AssetBookMergeId _assetBookId <span style="color: #008000;">=</span> assetBookId<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    assetBookId <span style="color: #008000;">=</span> _assetBookId<span style="color: #008000;">;</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> assetBookId<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h4>Groups and group sequence</h4>
<p>In the previous sample of code you can also see the SysOperationGroupMemberAttribute attribute. This is to determine which fields belong to a certain group on a dialog. And you can also use a custom sequence on groups by using the SysOperationGroupAttribute attribute as seen in the classDeclaration:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>
    DataContractAttribute,
    SysOperationGroupAttribute<span style="color: #008000;">&#40;</span><span style="color: #666666;">'Book'</span>, <span style="color: #666666;">&quot;@SYS95794&quot;</span>, <span style="color: #666666;">'1'</span><span style="color: #008000;">&#41;</span>,
    SysOperationGroupAttribute<span style="color: #008000;">&#40;</span><span style="color: #666666;">'Period'</span>, <span style="color: #666666;">&quot;@SYS40&quot;</span>, <span style="color: #666666;">'2'</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> AssetBalanceReportColumnsContract implements SysOperationValidatable
<span style="color: #008000;">&#123;</span>
    boolean visibleFR<span style="color: #008000;">;</span>
    AssetBookMergeId assetBookId<span style="color: #008000;">;</span>
    ToDate closingDatePriorYear<span style="color: #008000;">;</span>
    ToDate closingDateThisYear<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>So there you have it. If you want to rearrange things on the dialog, you can use the above method.</p>
<p>&nbsp;</p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/12/sysoperationframework-field-display-order/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/12/sysoperationframework-field-display-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Propagate infolog messages to the windows event log</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/propagate-infolog-messages-to-the-windows-event-log/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/propagate-infolog-messages-to-the-windows-event-log/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 00:16:37 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Dynamics Ax]]></category>
		<category><![CDATA[AX 2012]]></category>
		<category><![CDATA[Event viewer]]></category>
		<category><![CDATA[EventLog]]></category>
		<category><![CDATA[Infolog]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=398</guid>
		<description><![CDATA[The windows event viewer can be a nice tool to check for messages dispatched by the system. You can save the logs in there, reopen them, different kinds of information is available so you can actually trace lots of things in there. But wouldn&#8217;t it be nice to also be able to log the messages [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/propagate-infolog-messages-to-the-windows-event-log/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/propagate-infolog-messages-to-the-windows-event-log/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>The windows event viewer can be a nice tool to check for messages dispatched by the system. You can save the logs in there, reopen them, different kinds of information is available so you can actually trace lots of things in there. But wouldn&#8217;t it be nice to also be able to log the messages thrown by Ax 2012 in the windows event log?</p>
<p>That way you do not lose user messages and they are nicely logged into the event viewer. It can also help to log messages received on a client that you cannot seem to reproduce, &#8230;</p>
<p>Well, it is possible and here is how to do it in a couple of steps:</p>
<ul>
<li>Add a windows event log and source to put our specific infolog messages in</li>
<li>Edit the Ax32 config file to add an event log listener to the configuration</li>
</ul>
<p><strong>Create event log and source</strong></p>
<p>So first things first, let&#8217;s create a windows event log by using the following powershell command</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;">new<span style="color: #00007f;">-</span>eventlog <span style="color: #00007f;">-</span>logname <span style="color: #ff0000;">&quot;RealDolmen Ax Solutions&quot;</span> <span style="color: #00007f;">-</span>source <span style="color: #ff0000;">&quot;Ax 2012 Infolog&quot;</span></pre></div></div>

<p>The result should be like in the figure below</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/11/EventLog.png"><img class="size-full wp-image-399" title="Created Event Log" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/11/EventLog.png" alt="" width="631" height="353" /></a></p>
<p><strong>Configure the listener</strong></p>
<p>To add a listener, first open the ax32.exe.config file located in the clientbin directory. You should see a configuration similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;startup</span> <span style="color: #000066;">useLegacyV2RuntimeActivationPolicy</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;supportedRuntime</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;v4.0.30319&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;requiredRuntime</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;v4.0.30319&quot;</span> <span style="color: #000066;">safemode</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;assemblyBinding</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:asm.v1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;probing</span> <span style="color: #000066;">privatePath</span>=<span style="color: #ff0000;">&quot;EditorComponents&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/assemblyBinding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Modify the configuration so that it looks like this: (It is absolutely important to keep the source name !! The initializeData must be filled with the source you created in the event log)</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;system.diagnostics<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trace</span> <span style="color: #000066;">autoflush</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Microsoft.Dynamics.Kernel.Client.DiagnosticLog-Infolog&quot;</span> <span style="color: #000066;">switchValue</span>=<span style="color: #ff0000;">&quot;Information&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listeners<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #808080; font-style: italic;">&lt;!-- The initializeData contains the source that was linked to the created event log --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;EventLog&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;System.Diagnostics.EventLogTraceListener&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">initializeData</span>=<span style="color: #ff0000;">&quot;Ax 2012 Infolog&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listeners<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/system.diagnostics<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;startup</span> <span style="color: #000066;">useLegacyV2RuntimeActivationPolicy</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;supportedRuntime</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;v4.0.30319&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;requiredRuntime</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;v4.0.30319&quot;</span> <span style="color: #000066;">safemode</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;assemblyBinding</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:asm.v1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;probing</span> <span style="color: #000066;">privatePath</span>=<span style="color: #ff0000;">&quot;EditorComponents&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/assemblyBinding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now we are all set up and when firing up the client, any messages to the infolog should be redirected to the event log. So let&#8217;s send some error lines to the infolog.</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/11/InfologMessage1.png"><img class="size-full wp-image-401" title="InfologMessage" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/11/InfologMessage1.png" alt="" width="353" height="440" /></a></p>
<p>Now check if the same messages appear in the infolog. Normally this is what it should look like:</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/11/EventLogResultMessages.png"><img class="size-large wp-image-402" title="EventLogResultMessages" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/11/EventLogResultMessages-1024x395.png" alt="" width="1024" height="395" /></a></p>
<p>So there you have it. The messages are nicely logged in the event viewer. As a last remark, you can also adjust the logging level by modifying the switchvalue of the source. Off will not log anything at all, verbose will fill your event log with everything.</p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/propagate-infolog-messages-to-the-windows-event-log/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/propagate-infolog-messages-to-the-windows-event-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AX2012 Editor Extensions</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/ax2012-editor-extensions/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/ax2012-editor-extensions/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 21:54:09 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Dynamics Ax]]></category>
		<category><![CDATA[AX2012]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[Visual studio]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=393</guid>
		<description><![CDATA[Today I was reading a very interesting post about possible extensions to the editor in AX 2012 and I would very much like to share it. Basically it explains that the editor is a hosted visual studio editor (that was already clear) and by knowing this, it is also possible to use the extensions that [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/ax2012-editor-extensions/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/ax2012-editor-extensions/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Today I was reading a very interesting post about possible extensions to the editor in AX 2012 and I would very much like to share it.</p>
<p>Basically it explains that the editor is a hosted visual studio editor (that was already clear) and by knowing this, it is also possible to use the extensions that are available there to the editor inside Ax.<br />
The post I read was dealing with the brace matching extension that is available to do automatic formatting of the braces.</p>
<p>You can read the full post here : <a href="http://dev.goshoom.net/en/2011/10/ax2012-editor-extensions/">http://dev.goshoom.net/en/2011/10/ax2012-editor-extensions/</a></p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/ax2012-editor-extensions/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/11/ax2012-editor-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Client acces log</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/10/client-acces-log/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/10/client-acces-log/#comments</comments>
		<pubDate>Sun, 16 Oct 2011 11:43:20 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[Dynamics Ax]]></category>
		<category><![CDATA[Acces log]]></category>
		<category><![CDATA[Dynamics AX 2012]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=389</guid>
		<description><![CDATA[I&#8217;ve recently read a post on the performance team blog and I found it interesting so I&#8217;m posting the link again here. http://blogs.msdn.com/b/axperf/archive/2011/10/14/client-access-log-dynamics-ax-2012.aspx The blog post explains how to track user activity within the system. &#160;]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/10/client-acces-log/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/10/client-acces-log/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>I&#8217;ve recently read a post on the performance team blog and I found it interesting so I&#8217;m posting the link again here.</p>
<p><a href="http://blogs.msdn.com/b/axperf/archive/2011/10/14/client-access-log-dynamics-ax-2012.aspx">http://blogs.msdn.com/b/axperf/archive/2011/10/14/client-access-log-dynamics-ax-2012.aspx</a></p>
<p>The blog post explains how to track user activity within the system.</p>
<p>&nbsp;</p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/10/client-acces-log/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/10/client-acces-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AX 2012 Navigation Properties</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/09/ax-2012-navigation-properties/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/09/ax-2012-navigation-properties/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 08:57:16 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[Gaming]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=382</guid>
		<description><![CDATA[It&#8217;s been a while since I&#8217;ve posted, but here&#8217;s a small little post about what I think is a cool feature in Ax 2012! In AX2009, when you have a table that has a relation to another table and you want to use it in code, you have to provide a method that performs a [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/09/ax-2012-navigation-properties/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/09/ax-2012-navigation-properties/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>It&#8217;s been a while since I&#8217;ve posted, but here&#8217;s a small little post about what I think is a cool feature in Ax 2012!</p>
<p>In AX2009, when you have a table that has a relation to another table and you want to use it in code, you have to provide a method that performs a select on the other table and returned the related record. ( fe : SalesTable.SalesLine() ) Well this is something cool in AX2012. Here&#8217;s how you can do it now.</p>
<p>On the main table you have the relationship. There you can use a new property called CreateNavigationPropertyMethods and set it to Yes.</p>
<p><a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/09/CreateNavigationPropertyMethods.png"><img class="aligncenter size-full wp-image-384" title="CreateNavigationPropertyMethods" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/09/CreateNavigationPropertyMethods.png" alt="" width="453" height="335" /></a></p>
<p>Once you have done this, there will be a method on you table that returns the related record.</p>
<p style="text-align: center;"> <a href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/09/CreateNavigationPropertyMethods2.png"><img class="aligncenter" title="CreateNavigationPropertyMethods2" src="http://www.ksaelen.be/wordpresses/dynamicsaxblog/wp-content/2011/09/CreateNavigationPropertyMethods2.png" alt="" width="567" height="102" /></a></p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/09/ax-2012-navigation-properties/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/09/ax-2012-navigation-properties/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL Server : Change TempDB location</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/04/sql-server-change-tempdb-location/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/04/sql-server-change-tempdb-location/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 12:22:02 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[TempDB]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=363</guid>
		<description><![CDATA[This is no rocket science but today I needed to move the tempDB to another disk. This is something I though could be done by changing the location path on the database properties in the files tab. Well, bummer, the location was not editable there. So how can we do this&#8230; ? Running this query [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/04/sql-server-change-tempdb-location/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/04/sql-server-change-tempdb-location/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><div>This is no rocket science but today I needed to move the tempDB to another disk. This is something I though could be done by changing the location path on the database properties in the files tab. Well, bummer, the location was not editable there. So how can we do this&#8230; ?</div>
<div>Running this query will solve this for you :</div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span></div>
<div>USE</div>
<div><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">master</span></span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">;</span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">GO</span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">ALTER</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">DATABASE</span></span><span style="font-size: x-small;"> tempdb</span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">MODIFY</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">FILE </span></span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">(</span></span><span style="font-size: x-small;">NAME </span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">=</span></span><span style="font-size: x-small;"> tempdev</span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">,</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">FILENAME</span></span><span style="font-size: x-small;"> </span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">=</span></span><span style="font-size: x-small;"> </span><span style="color: #ff0000; font-size: x-small;"><span style="color: #ff0000; font-size: x-small;">&#8216;F:MSSQLDatatempdb.mdf&#8217;</span></span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">);</span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">GO</span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"> </span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">ALTER</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">DATABASE</span></span><span style="font-size: x-small;"> tempdb</span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">MODIFY</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">FILE </span></span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">(</span></span><span style="font-size: x-small;">NAME </span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">=</span></span><span style="font-size: x-small;"> templog</span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">,</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">FILENAME</span></span><span style="font-size: x-small;"> </span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">=</span></span><span style="font-size: x-small;"> </span><span style="color: #ff0000; font-size: x-small;"><span style="color: #ff0000; font-size: x-small;">&#8216;F:MSSQLDatatemplog.ldf&#8217;</span></span><span style="color: #808080; font-size: x-small;"><span style="color: #808080; font-size: x-small;">);</span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">GO</span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span></div>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/04/sql-server-change-tempdb-location/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/04/sql-server-change-tempdb-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance in Dynamics Ax 2012</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/performance-in-dynamics-ax-2012/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/performance-in-dynamics-ax-2012/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 18:54:20 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[Dynamics Ax]]></category>
		<category><![CDATA[AX 2012]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Trace Parser]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=358</guid>
		<description><![CDATA[Today I attended what I think was the most interesting session of the conference for me. (There will be one about AIF today but I think this will not as interesting as what I learned about performance) Basically what they did can be devided in these categories : Scale up and scale out on AOSs [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/performance-in-dynamics-ax-2012/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/performance-in-dynamics-ax-2012/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Today I attended what I think was the most interesting session of the conference for me. (There will be one about AIF today but I think this will not as interesting as what I learned about performance)</p>
<p>Basically what they did can be devided in these categories :</p>
<ul>
<li>Scale up and scale out on AOSs and Clients<span style="font-family: Times New Roman; font-size: 12pt;"><br />
</span></li>
<li>Utilize more SQL features<span style="font-family: Times New Roman; font-size: 12pt;"><br />
</span></li>
<li>Application effeciency<span style="font-family: Times New Roman; font-size: 12pt;"><br />
</span></li>
<li>World class diagnosis tools<span style="font-family: Times New Roman; font-size: 12pt;"><br />
</span></li>
</ul>
<h3>SysGlobalObjectCache</h3>
<p>The first part was about caching. They added a global cache but this time the cache is also available across sessions.<br />
The cache also get syncronised between the AOS instances, but there is a short delay on this, so you never really can trust that the cache is identically on the other AOS Instances.</p>
<p>As to when the objects in the cache are cleared, there are two main triggers for deleting an object from the cache:</p>
<ul>
<li>The limit of number of objects is reached (to be found in the SysGlobalConfiguration table on SQL Server</li>
<li>The developer deletes / overwrites the object in the cache</li>
</ul>
<h3>TraceParser</h3>
<p>Before the trace parser was a tool to be installed additionally to Ax but now it is part of the system. There are a few ways in which you can use the trace parser:</p>
<ul>
<li>By starting up the performance cockpit from the tools menu</li>
<li>By using it to code by starting and stopping trace and specifying a file to log to.</li>
</ul>
<p>So this time it is actually much more stable and reliable to use. Actually now it is so easy that each developer should develop with the trace parser next to him at all times to keep performance in mind from the beginning.</p>
<h3>Data Access : Ad Hoc mode</h3>
<p>When your X++ query is getting too big, then use Ad Hoc mode. Here you would actually only select the fields you need.<br />
Also, set the dynamics property on the query fields to false and set OnlyFetchActive to true on the FormDataSource</p>
<p>By selecting only the things you need, the kernel will not join all the tables in the table hierarchy but also the inherited tables where you need fields from.</p>
<h3>SQL TempTable</h3>
<p>In the AOT, you can now set the TableType on a table object to one of the following :</p>
<ul>
<li>InMemory (The old in memory temp table)</li>
<li>Regular (Non temporary table)</li>
<li>TempDB (SQL Server tempDB table)</li>
</ul>
<h3>SysOperation</h3>
<p>Here I can be brief (because the white paper about this is going to follow later on)</p>
<p>Basically the RunBase framework is now only there for backward compatibility! So now the new SysOperation framework will be used.<br />
This is residing in the AOS also, but more on that when I have a clearer view on this.</p>
<p>So this is what I could capture from the session. Probably missed a lot of other stuff too but for that, we will have the video&#8217;s <span style="font-family: Wingdings;">J</span></p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/performance-in-dynamics-ax-2012/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/performance-in-dynamics-ax-2012/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dynamics Ax 2012 Technical conference : Day 1 : Part 1</title>
		<link>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/technical-conference-day-1-part-1/</link>
		<comments>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/technical-conference-day-1-part-1/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 19:25:27 +0000</pubDate>
		<dc:creator>Kenny Saelen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Dynamics AX 2012]]></category>
		<category><![CDATA[Programming model]]></category>
		<category><![CDATA[Technical Conference]]></category>

		<guid isPermaLink="false">http://www.ksaelen.be/wordpresses/dynamicsaxblog/?p=352</guid>
		<description><![CDATA[This articles will be brief, because I don&#8217;t have much time between the sessions J Yesterdag was the first day of the Dynamics Technical conference and following sessions were attended by me: Programming model improvements Part 1 of 2 Programming model improvements Part 2 of 2 Developing in .NET managed code and X++ Enhancements Solving [...]]]></description>
			<content:encoded><![CDATA[<span class="fb_share"><fb:like href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/technical-conference-day-1-part-1/" layout="box_count"></fb:like></span><fb:like href='http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/technical-conference-day-1-part-1/' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>This articles will be brief, because I don&#8217;t have much time between the sessions <span style="font-family: Wingdings;">J</span></p>
<p>Yesterdag was the first day of the Dynamics Technical conference and following sessions were attended by me:</p>
<ul>
<li>Programming model improvements Part 1 of 2</li>
<li>Programming model improvements Part 2 of 2</li>
<li>Developing in .NET managed code and X++ Enhancements</li>
<li>Solving the element ID problem</li>
</ul>
<h2>Programming model improvements Part 1 of 2</h2>
<p>From this session, I remember the following additional features:</p>
<ul>
<li>Table inheritance is added. So now you can have abstract tables which are then inherited by child tables.<br />
The unit of work pattern also comes into play here as there will be issues to address to manage transactions and code dealing with one &#8216;virtual record&#8217; which may consist of multiple child tables. (Vehicle table with child tables bycicle, car, truck, …)</li>
<li>Next to normal X++ temporary tables, there is now also support for temporary tables in SQL Server</li>
<li>Date effective tables have been added. This means you can actualy filter records based on an &#8216;effective as of date&#8217;</li>
<li>Eventing has been added so now you can actually subscribe methods to events on other classes. Also, this is implemented by drag and drop so it is actually user friendly to do this.</li>
<li>The normal batch framework has been &#8216;adjusted / replaced&#8217; with the SysOperation framework</li>
<li>The tree of linked tables are then linked by RecId, but you can actually have a key with fields specified in a field group to be used in the design when showing on what the linked was based</li>
<li>Tables have full text indes support now : This means they can be optimized for searches on text fields to look for certain words in the body.</li>
</ul>
<h3>Historical data pattern</h3>
<p>This one is actually cool. Let&#8217;s say you have a historical table to contain a history of sales. Then you can set properties on the SalesTable datasource and the kernel will keep the history for you. So when you change values on the sales order for example, the kernel will create / update records in the historical data table.</p>
<h3>Query ranges vs Query filters</h3>
<p>When using joins (outer joins) the query ranges can produce incorrect outcomes. But now query filters are used to fix that. Instead of using the QueryRange object on the query, you can now also use QueryFilter objects and they are more optimized for SQL Server.</p>
<p>The other sessions will be describes in following posts as there is new session beginning right now <span style="font-family: Wingdings;">J</span></p>
<div class="plus-one-wrap"><g:plusone size="medium" href="http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/technical-conference-day-1-part-1/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.ksaelen.be/wordpresses/dynamicsaxblog/2011/01/technical-conference-day-1-part-1/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

