Hello.
I have a backlink relationship through two objects inside my app
public class JobwalkItem : RealmObject
{
[PrimaryKey]
[MapTo("_id")]
public string Id { get; set; } = Guid.NewGuid().ToString();
[Required]
[MapTo("_partitionKey")]
public string PartitionKey { get; set; }
public int Count { get; set; }
public double UsePeriod { get; set; }
public string Name { get; set; }
[Backlink(nameof(JobSummaryItem.JobwalkItem))]
public IQueryable<JobSummaryItem> JobSummaryItems { get; }
}
public class JobSummaryItem : RealmObject
{
[PrimaryKey]
[MapTo("_id")]
public string Id { get; set; } = Guid.NewGuid().ToString();
[Required]
[MapTo("_partitionKey")]
public string PartitionKey { get; set; }
public JobwalkItem JobwalkItem { get; set; }
public JobSummaryItem ParentItem { get; set; }
public bool HasChildren { get; set; }
public int ItemCount { get; set; }
public double TotalCubes { get; set; }
public int TotalMoveLaborTime { get; set; }
public double TotalUsePeriod { get; set; }
}
When I delete a JobwalkItem
I assume that it’s JobSummary
items also should delete from database. But this does not happen and I need to manually delete all related JobSummary
items and then delete JobwalkItem
.
So the question is following. Is that an expected behavior and the cascade deletion is applicable only for embedded objects?