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



Comments
Post a Comment