Home > Ax 2012, Ax2012R2 Conference Updates > Programming Improvements with Dynamics Ax 2012 R2

Programming Improvements with Dynamics Ax 2012 R2

October 25, 2012 Leave a comment Go to comments
This was one of the very interesting session we had :). As a developer it was really exciting to see how we can scale the application further.

LINQ:

– Though the .net integration worked well with through Ax proxies there was a void when it comes data acess.
– The X++ team has come up with a LINQ provider that will fill up this gap.

Highlevel: X++ LINQ Provider will create a search tree based equivalent for the C# search tree created through LINQ

What this means ? You can access data from AOT Tables through LINQ with just few lines of code, something like the one below.

</pre>
//Pseudo not exact syntax
 QueryDataProvider query = new QueryDataProvider('TableName');

//Rest the regular Linq Syntax applies
<pre>

– Since LINQ Queries are composable the data once fetched can be applied with multiple composable ranges further E.g

</pre>
QueryDataProvider query = new QueryDataProvider('select custtable');

 var results = from qr in query
 select new (q.custaccount, q.custName)
 //prints the all the customer records
 foreach (var result in results)
 {
 Console.WriteLine(result);
 }

 //basically for a single result set fetched in query
 //you can apply multiple select criteria later to fetch data
 //This is like narrowing a search result further
 var results = from qr in query
 where qr.custName like 'Test*'
 select new (q.custaccount, q.custName)
 //prints the all the customer records
 foreach (var result in results)
 {
 Console.WriteLine(result);
 }
<pre>

– You can filter based on expressions

– Field list concept is no more applicable. The choice of fields is automatically decided by the linq framework based on the conditions applied in each case.

– query is not executed untill the results are fetched.

– Folks, the advantages mentioned here are just to give you a feeling but it is limitless. All advantage that LINQ has brought in to the C# space is now applicable for data access to X++ tables.

– Remember this is LINQ Provider on the C# end and not on the X++. Means basically it works for the Visual Studio Projects

– LINQ Project Portal – http://msdn.microsoft.com/en-us/library/vstudio/bb397926.aspx

Keep watching the X++ team blog as Peter Villadsen who detailed this has promised to put more examples here 🙂

LINQ – Points to note

Solver Foundation

– OR(Operation Research) issues like the travelling sales man problem, transportation problem can be solved with the help of solver Foundation

Solver Foundation is a mathematical modelling API brought in place by Microsoft. Solver Foundation is sold seperately to customers (Read more here).

-But the Good!!! news is that it comes fully licensed with Dynamics Ax

– Leverage this Solver Foundation to solve problems concerning with Optimization(Shortest Route), Bin Packing(Optimal allocation)

– The dll is present in the Dynamics Ax installation(Client i guess) and you can just add it to your reference and get to use it.

– Solver foundation is used by standard Dynamics Ax in constraint based product configurator.

Code Upgrade Tool

– Microsoft is trying to see how it can reduce the pain of code upgrade with rollup and major releases. CUT is an outcome of this exercise.

– This is very very powerful, as AST(Abstract Syntax Tree) is created for the X++. (Similar to Roslyn Project for C#)

What is an AST ? AST is a DOM(XML sort of) representation of a method or a class.This means the variables in a class could just be a node in the DOM and can be easily queried. Similarly expressions, Types etc.

How does this help ? unlike the X++ parser output the output of AST is simple, structured, queryable. Which means you can easily manipulate code based on Rules..
– E.g:

– All methods must have a access specifier, if not an access specifier is entered automatically
– If there is a IF condition it must have braces around
– Format the code

Architecture

What it has to do with Code Upgrade ? Means, the system will try to better manage automatic merge and simplify the process. The CUT tool that is to come will create automerged objects and put it in a patch layer(not sure if it is patch). Then one can review to decide to keep the changes or eliminate them

What other use AST has ? The Life cycle tools that are built my Microsoft relies on the AST to analyze the code metrics.

Can i use it for older versions ? No it can’t be used. Since AST can’t be built for older versions.

When is CUT available ? Not confirmed as of now.

Code Upgrade tool (AST visible on the left)

  1. September 11, 2013 at 11:26 am

    Really awesome post the above post is sharing most informative information… Share on: Microsoft Dynamics AX Implementation

    Thanks again!!!

  2. August 27, 2013 at 1:18 pm

    Really nice post!!! Microsoft Dynamics AX is an adaptable business management solution that enables companies and their workers to make business decisions with greater confidence.The Microsoft Dynamics AX Implementation above post is very useful…

  1. No trackbacks yet.

Leave a comment