I have a PrivilegeGroup table, a Privileges table and a link table because the PrivilegeGroup table and the Privileges table is a many to many relationship. I am thinking about load all contents of PrivilegeGroup table and Privilege table into memory from database at beginning when application started.
I want to save them in a form easily to look up. Usually we will look up the PrivilegeCode via GroupId.
Which structure is good for this purpose? array of list? dictionary?
How about
This way you can quickly get the HashSet of privileges by GroupId, and do a quick test against the HashSet to check if the privilege exists.