Sunday 31 January 2016

Runnable classes and table browser in Dynamics Ax 7

Purpose of This post to explore the runnable classes to test the logic, checking the traditional X++ (AX 2012) code and new table explorer in Dynamics Ax 7.  This post is based on Dynamics AX (Dynamics AX 7) CTP 8.



In new Dynamics Ax (Dynamics AX 7) there is no more AX Jobs.  For testing certain logic we have to use runnable classes.



Suppose we have to test the logic for some service, which has data contract and Service contract classes.


Right click inside solution explorer and add new object and select runnable class.






New Item



New Job


Add test logic as
class HelloWorld
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = “_args”>The specified arguments.</param>
public static void main(Args _args)
{
ColorDC dc = new ColorDC();
ColorSc Sc = new ColorSc();
dc.parmColorName(“Red”);
Sc.InsertColor(dc);
dc.parmColorName(“Green”);
Sc.InsertColor(dc);


}

}

Now expand the project properties and set my Hello world class a start up object'


sss

To explore the debug feature I add a break point and press F5. With debug window a new diaglonsitic tool runs, which shows memory and space used by my code processing.

I just test the traditional X++ code, Its works the same way as it was in Morphix editor in tradition AX (2012).
public void InsertColor(ColorDC Colorobj)

{

MyColorTable _Color;

Name _Name;



_Name = Colorobj.parmColorName();



select * from _Color where _Color.ColorName== _Name;



if (_Color==null)

{

try

{

ttsBegin;

_Color.ColorName = _Name;

_Color.insert();



ttsCommit;

}

catch

{

ttsAbort;

}



}

}

Now right click on table and from properties popup menu click on table browser.
2016-01-02_21-43-18



The new table browser inside Visual studio show me the values just inserted during debugging of above mentioned code.




sss3333

No comments:

Post a Comment