Cascade deleting one-to-one linked entities

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
AvoiDFaTE
Posts: 1
Joined: Tue 02 Oct 2018 04:01

Cascade deleting one-to-one linked entities

Post by AvoiDFaTE » Tue 02 Oct 2018 04:09

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?

MaximG
Devart Team
Posts: 1136
Joined: Mon 06 Jul 2015 11:34

Re: Cascade deleting one-to-one linked entities

Post by MaximG » Wed 03 Oct 2018 09:45

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).

Post Reply