I have four classes
- User
- profiles
- Activity
- Workbook
- user can have many profiles based on per year. Every year diff profile
User profilewill havemany to manywithActivities
so there will be profile_activities table with profile_id and activity_id
Now User will do 1 workbook per activity per profile
so i am confused how to map in database
I’ve revised my suggestion in light of your comment.
Perhaps could have an UserActivity class which has an Activity property and a Workbook property.
Then you can have a User class with a property that is a list of Profile classes, and the Profile class will have a property that is a list of UserActivity classes.
This satisfies your object model.
So the UserActivity table will have a foreign key to a row in the Profile table (which will be its parent ID), and foreign keys to the Activity and Workbook tables.
Your Profile table has a foreign key to a row in the User table which is its parentID.