sonal malhotra

sonal malhotra

  • 1.6k
  • 375
  • 9.9k

The DELETE st conflicted with the REF constraint in mvc

Jan 13 2020 3:36 AM
hello mvc users,
 
i cant understand that error
 
The DELETE statement conflicted with the REFERENCE constraint "FK_dbo.Appointments_dbo.Patients_PatientId". The conflict occurred in database "ClinicDB", table "dbo.Appointments", column 'PatientId'.
 
The statement has been terminated. And
 
And in patient configuration class
 
there is code below
 
HasMany(p => p.Appointments)
.WithRequired(a => a.Patient)
.WillCascadeOnDelete(true);
 
what else ? anything
how to fix this prob?

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (11)