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

Popular posts from this blog

Error: The client and server cannot communicate, because they do not possess a common algorithm.

How to split comma separated string into rows in mysql?

Disable Copy Paste And Mouse Right Click JavaScript, jQuery