I have the following database model:
[User] Id Name [Role] Id Name [UserRole] UserId RoleId IsActive
And I want to create a nice way to represent this relationship and the property that is in it with objects without creating a class to represent UserRole table.
Any ideas?
Thanks a lot!
Just have an attribute of a user object called “roles”, which contains a list of roles.
You can also have 2 attributes, one for a list of active roles one for inactive ones, in case you need to manage the active flag using that object.
Also, you can have a role object’s attribute listing the users in that role (either instead of or in additional to the role attribute in user object) – again possibly with “inactive” copy.