How to use a recurring Integration Endpoint for importing data
Part 18 - Order Of Operations for Data Entities
Let's explore the order of operations when using a data entity.
When creating a solution that may use a data entity, OData or not, it may be helpful to understand the precise order of operations for what gets called when in the call stack. Also, when extending OOTB data entities, what changes you are going to make may have changes to the overall performance of the data entity depending on where you put them. Since data entities are generally not the most performant things even at the best of times, having a deep understanding of what is occurring when can help prevent performance headaches later.
Who does What When Why?
Each operation with a data entity (CRUD + Action method(s)) has a slightly different execution path depending on how it is called, what operation is being used and by what consumer (external, like C#, or internal with X++). I created a custom entity for a custom table that simply let me record all of the operations with each method call for all available kernel methods being logged to a file. Each diagram shows what is called at what level simply when invoking the entity from an OData endpoint. The findings are below. Each diagram is built as similar to a call stack tree so you can see what calls what or what is nested in what. For instance, in OData Create, line 3 PostLoad() would be called after line 2's InitValue with PostLost being called as part of InitValue(). Additionally, based on how you consume the data entity, the call stack may change. Below is the most exhaustive call stack possible but if you are consuming the data entity in x++ rather than though an OData end point, the call stack will differ. The Excel file at the end of the post contains both paths for you to review.
Legend
OData Create
OData Update
OData Delete
OData Action
OData Read
DMF Insert
DMF Update
DMF Export
Conclusion
As you can see, what appear to be simple interactions with data entities are actually complex chains of calls depending on how the data entity was created. if you'd like an Excel version of the call tree, please see https://github.com/NathanClouseAX/AAXDataEntityPerfTest/tree/main/Projects/AAXDataEntityPerfTest/Excel. Additionally, Thanks to Uwe Kruger for the initial idea.
Blog Main Tag: