Total Pageviews

Search This Blog

Sunday, June 19, 2011

Update - Tip - Visual Studio 2010 Ultimate and Dynamics AX .Net Business Connector Compatibility Settings

Issue:

I bumped into this error when building my .Net app (using Visual Studio 2010 Ultimate)  which consumes Dynamics AX 2009 (.Net Business Connector assembly)

 Solution -

Update - In my specific scenario, I'm not leveraging any of the .Net 4.0 Framework features, so I just changed the Framework Version to 3.5 to make this work.



But, if you are targetting .Net 4.0, you need to perform an additional change in config after you change the Framework version to 4.0 otherwise you will run into the following error:

"Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information"

In order to fix this error, just add this specific entry in your app.config under configuration section:
startup useLegacyV2RuntimeActivationPolicy="true", so now your modified app.config should look like the below:

And you should be good to go now with .Net 4.0!

P.S Florian has a theory on .Net 4.x compatibility with AX 2009 BC in his blog , but without making this additional change in config as I have shown above, it won't work and as said before I was just using a basic .Net 3.5 targetted app just to test one of my AX BC Classes

Wednesday, June 8, 2011

Tip - Maximizing Performance of Master Scheduling Job

Issue - We had this issue where Master Scheduling nightly batch job was taking more than 3-4 hours to complete.

Solution - Set up the Helpers count to a number more than 0, in our case 8 was a decent figure as it reduced the job completion time from 4 hours to 45 mins. By setting the helper count, it spawns into multiple threads/multiple tasks thereby making the job quicker.


Tip – EP Customization ( Dynamically Loading Report Folder from Network based on Store Parameter)


Overview
I had this requirement where based on the logged in Store Number, the user should be able to open the corresponding Report Store Folder (located in an UNC Network Path) from Enterprise Portal web page

Solution/WorkArounds:
Initially, tried writing a separate web part which loads a .Net File Dialog user control box but it was turning out to be complex so left the approach as time was limited
Then, tried the out of the box Page Viewer Web Part but it has the limitation wherein you can't dynamically load the network path and in order to attain it, one needs to write a custom Dynamic Page Viewer Web Part which is another time consuming and complex customization.
After some investigation, I found a much simpler way to achieve this.
  1. Wrote a dynamic Java Script which queries the Network Path from AX Table
  2. Pass the store parameter to it
  3. Loads the UNC Path dynamically on the fly based on the store parameter
This is the code segment which picks up the Network Path and then dynamically appends the store id to it based on the logged in user's store id profile

  
Tip: Initially, I was using the ClientScript.RegisterStartupScript method to register the script block but landed into the same issues this bloke was facing when trying to load from webpartzone.
, ScriptManager came to my rescue here.
Below is the button in action on our portal Site (Role Center Page) which loads the network Report path
   

Thursday, May 19, 2011

Tuesday, May 17, 2011

Tip - How to avoid Overriding of SQL Indexes from AX when a Full Synchronization is done


There's this stored procedure written in SQL which retrieves historical order data and displays it on the Commerce Server Website. This SP uses almost 13 tables to retreive the data from (which includes custom and standard AX tables).

We added few indexes from AX to boost performance but in vain as when we run the Query Execution Plan, the Subtree cost of the index still shows more than 80%. SQL Server 2008 suggests new indexes which can be added via SQL to improve the performance of the query. I tried the indexes suggested by SQL and immediately the performance boost can be observed.

After some investigation, I found that the index added by SQL is different from index added via AX as AX doesn't have the capability to add the INCLUDE keyword when we create a new non-clustered index which SQL does as shown in the screenshot below





Here's something more about the include keyword from MSDN


Index with Included Columns
You can extend the functionality of nonclustered indexes by adding nonkey columns to the leaf level of the nonclustered index. By including nonkey columns, you can create nonclustered indexes that cover more queries. This is because the nonkey columns have the following benefits:
•    They can be data types not allowed as index key columns.
•    They are not considered by the Database Engine when calculating the number of index key columns or index key size.
An index with included nonkey columns can significantly improve query performance when all columns in the query are included in the index either as key or nonkey columns. Performance gains are achieved because the query optimizer can locate all the column values within the index; table or clustered index data is not accessed resulting in fewer disk I/O operations.


Issue

Whenever a synchronization is done, AX overwrites the indexes which we put through SQL

Resolution

a. Created the index via AX as a table method



b. Modified the Application Class/dbsynchronize method so that after synchronization it invokes the table method to create index (mentioned above in Step a)

So, by doing this we have the SQL Indexes intact as we are recreating the index once AX finishes it's synchronization thereby avoiding the overwritten part