Concept of reflection and its implmentation in Dynamics AX
Views (3)
Key benefits of applying the concept of reflection in your programming are:
Hope this peace of code will help you in working on reflection in Dynamics AX.
- It gives you run-time access to a variety of class information.
- It even lets you read and write fields and call methods of a class selected at run time.
- With reflection, you can make your own tools to audit code or to generate code.
static void TraverseAOTTableMethods(Args _args)
{
SysDictTable sysDictTable;
SysDictMethod sysDictMethod;
DictMethod dictMethod;
int ind;
TreeNode curTable, methods, curMethod;
TreeNodeIterator tableiter, methodIter;
tableiter = TreeNode::findNode(@'\Data dictionary\Tables').AOTiterator();
if (tableiter)
{
curTable = tableiter.next();
while (curTable)
{
ind=1;
methods = curTable.AOTfindChild("Methods");
methodIter = methods.AOTiterator();
if (methodIter)
{
curMethod = methodIter.next();
if (curMethod == null)
{
curTable = tableiter.next();
continue;
}
while (curMethod)
{
sysDictMethod = SysDictMethod::newTreenodePath(curMethod.treeNodePath());
info(strFmt("%1",sysDictMethod.name()));
curMethod = methodIter.next();
}
}
curTable = tableiter.next();
}
}
}
Hope this peace of code will help you in working on reflection in Dynamics AX.
This was originally posted here.
*This post is locked for comments