Page 1 of 1

Cascade deleting one-to-one linked entities

Posted: Tue 02 Oct 2018 04:09
by AvoiDFaTE
Hello.

Using Delphi XE5 and EntityDAC 2.0.1.

I have two entities linked one-to-one:

Project( Id, Name, ... ) and ProjectSchedule ( Id, ProjectId, ... );

In general schedule's fields may be easily inluded in Project table but I separated it for further possible needs. So, in Entity Developer I linked them as one-to-one relationship with Cascade=True and Delete_Rule=Cascade. Ok. But when I try

Code: Select all

project.DeleteAndSave( True );
I get and DB exception: FK violated. Child record found.

But if I change relationship to one-to-many the same works fine. But in this case access to schedule looks like

Code: Select all

project.ProjectShedules.First
which is really terrible.

How to cascade delete one-to-one related entities?

Re: Cascade deleting one-to-one linked entities

Posted: Wed 03 Oct 2018 09:45
by MaximG
We tested the work of EntityDAC 2.0.1 according to your description and found no issues. Please compose and send us a simplest sample, in which the issue occurs. In addition, we will need the model (*. enml) and the DDL script to create tables used in this sample. For your convenience, please use the e-support form (https://www.devart.com/company/contactform.html).