I want to handle user authorization access to every form and control in my project, I did it manually in my previous projects using many checkboxes and writing many lines of codes, but now I want to handle it automatically, so I loop through each form to get its controls (and components Devexpress) and save them in TreeNode, after this, I saved checked state of each node/child node in a 2D array of strings that contain form name, control name, checked status, now in startup I formed the code that can be evaluated and executed in runtime to enable or disable the control for example:
"FRM_NAME.ControlName.enabled = false;"
I see some topics about executing codes in runtime but I was blocked in many situations, for example, Roslyn is not supporting .net framework 4.5.2 (my current version) I tried other libraries but they execute a separate code that is not related to my project.
I have 02 questions:
1- What is the best way to handle user authorization access looping through all controls automatically?
2- How to evaluate code formed as a string like:
Evaluate("FORMNAME.CONTROLNAME.Enabled = false;");