I need to develop a winform with a treeview menu, localizable and with different options in case of each user (role and single-user based).
The only solution I can imagine is really unmaintainable:
- Everything loaded and watched from database.
- A table to define the menu (child-of…).
- Every option in the menu should have a Form name to find and open it with reflection.
- A table with translations to each language related to each option in the menu.
- A table with permissions for each user and option (to show or hide it).
Is there any simpler solution??? I really don’t want to do this kind of stuff 😎
Thanks in advance.
We have actually implemented exactly what you are describing here (with the only difference being that we are using one language) and it works quite well. The fact that the menu can be altered at runtime has been used multiple times where any other implementation would have required a code release.
I am not sure why you say that it is not maintainable – the system has been in use for years now and we hardly ever need to spend time on the code that makes it all work.
A different system that I am involved in we build the menu at design time and then just have a lookup table with all the menu buttons in the database – it actually feels a lot easier to get something wrong there than when everything is in the DB.