When there are composite keys in database table and when you try to put data annotation it will throw below error
Entity type ‘Orgmember’ has composite primary key defined with data annotations. To set composite primary key, use fluent API
The above code will not work and throw an error
Here is the solution for this problem
Step 1: Modify your modal class like
Step 2: Use the fluent API to set up a composite key.
Hope it helps!