WHat is MXmodel reflection and why do we use it? PLease explain me in your words , do not post the link of mendix docs.

Hi experts, i was going through MXModel reflection doc on mendix but I could not understan what exactly is mxmodel reflection and why do we use it. Can any one please explain me in theire own words please?
3 answers

hii Harsh Bhanushali,

mx model reflection is a marketplace module.

And why we use it.

firstly understand the scenerio ,

lets take a example : you have to import the data into a entity from excel file.

In this case you will have to access the columns of the entity to map with you excel sheet data  so you can insert right excel column data into right column of your entity.

so in this type of scenerio we need to access our entities into our overview pages for mapping so Mx model reflection module allow us to access our module entities and microflows usage on overview pages. 


if you have still any doubt why we use mx model reflection kindly comment here.



sanjay kushwah


I firstly appreciate the responses from other members, just because I felt this could be explained in another simple way, adding my opinion on this.


Imagine you created a leave request app. Students can add a new leave request including their respective student name, roll number, and specific dates for leave. The principal was given access to either approve/reject the leave request. This is the basic outline of the app, and the app was already deployed and running. Now suddenly principal requested you to help him add a new feature to the description section to be filled by the student, mentioning their reason for the leave. 


Now, Let's differentiate by explaining without using model reflection and with using model reflection. Firstly, If you choose not to use model reflection to implement the new feature, you will need to manually update the microflows, pages, and other components of your Mendix application to incorporate the desired functionality. This may involve writing new code or modifying existing logic to support the interaction between the principal and the student regarding the reason for the leave request. 


Secondly, using model reflection offers several benefits one such is Dynamic Form Generation, if you need to add new fields or attributes to the leave request entity (e.g., a reason field for the principal to ask the student for the reason), the application can adapt dynamically without requiring manual updates to the forms or UI components, i.e by adding a new attribute (Reason) to the leave request entity to the data model, the application can dynamically adjust the leave request form to include the new "Reason" field without any manual intervention of manually updating the microflows and pages.


In this way using model reflection benefits flexibility, maintainability, and consistency. Some cons come along with implementing model reflection including additional complexity to the application and performance overhead. Still without using model reflection is also a bad move, especially in applications with frequent changes to the data model. So the decision to use model reflection is dependent on the particular project goals and priorities.


Hi Harsh,

Mx modelreflection contains a lot of logic to make the running app aware of it’s domain model (database), and it’s logic (microflows,...)

This can be usefull for other modules like the excel import or export module where you want attributes of your entities in the export or import. The templates these modules use can be configured at runtime (in the app itself) and therefore the runtime needs to be aware of all the info about the domain.