On updating database in Entity Framework , Code first Migration, I am getting this error:
The ALTER TABLE statement conflicted with the FOREIGN KEY constr
This error is telling you that you are violating the foreign key constraint. To resolve you have a few solutions
Clients table that have a MedicalGroupId that does not exist in the in the
MedicalGroups table. Write a query to find out what IDs do not
exist in the MedicalGroups table and manually fix the data
yourself.WITH NOCHECK - You can create your foreign key constraint using the WITH NOCHECK option. This option tells SQL Server to not apply this constraint to existing data. SQL Server WILL check this constraint in any future INSERTS/UPDATES/DELETES.