From the follow up from Part 1, this post is more about how to find what models are dependent on what. I have created a console app which outputs csv files and can be downloaded here.
The inner workings:
So we know that ModelElement and ModelElementData hold the AOT objects for the respective models.
ModelElementData is the granular data. So a table field, a class method, a form control are stored here. They link to their parent using the ParentHandle field, or straight to the Main AOT object using the RootHandle.
The app takes every layer, from the ISV onwards , analyses each model and the model element data in them. It then looks if the element is used by any other layer below it OR if the root element is used in any other layer below or in the same layer.
How to use the App:
- Set the minimum access layer – If you dont care about the SYS /SYP then set the Layer id to that of the ISV. Ofcourse if you work from VAR and beyond, then you probably dont care about ISV / ISP. So look at the Layer table and set the minimum access layer
Set this in the Tag “MinApplicationLayer” inside the App.config file
- Connection String – You dont need to set this up, unless you want to default to a specific Ax Database. This is good if you only care about one application. When the App runs, it will ask for user input for the database server and name. Not entering it will revert to the connection string in the App.config file
This is still a command line application, the output is still on the screen. But that’s the next phase of this app, to output the data to files or on screen. And also to make it power shell friendly
Ok, how the app works now:
Run the Exe in a command prompt: AxModel.Common.Exe (I will work on the name, I promise), put the database server, and the database name, and after a few verbose output data in a CSV format is spit on the screen.
Copy that to excel and it should be all good from there.
The verbose output also outputs the dependencies if you want to look at it, which may be helpful.
Limitations: If you are referencing objects from one model to another in code, like a method in another object is called from a class, then that will not be detected. This is mainly because cross reference will need to be looked at and is out of scope at this stage. I am focusing on installation dependencies
The code is available on GitHub and I should be updating it more as I conduct more tests and get more input about this.