Delete the primary entity and delete the sub entity in cascade. The deleting event of the sub entity cannot be triggered
See original GitHub issueDelete the primary entity and delete the sub entity in cascade. The deleting event of the sub entity cannot be triggered?
public class ProductionOrder : AuditedMustHaveTenantEntity<long>
{
public string Code { get; set; }
public List<DispatchOrder> DispatchOrders { get; set; }
}
public class DispatchOrder : AuditedMustHaveTenantEntity<long>
{
public long ProductionOrderId { get; set; }
public string Code { get; set; }
}
public class DispatchOrderDeletingEventHandler : IEventHandler<EntityDeletingEventData<DispatchOrder>>,ITransientDependency
{
public void HandleEvent(EntityDeletingEventData<DispatchOrder> eventData)
{
//Delete the productionOrder to delete the dispatchOrder in cascade,but this event cannot be triggered
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Cascade Delete - EF Core
Configuring cascading behaviors triggered when an entity is deleted or severed from its principal/parent.
Read more >Can't delete child entity without deleting parent ...
spring boot - Can't delete child entity without deleting parent entity, regardless of CascadeTypes? - Stack Overflow.
Read more >Why you should avoid CascadeType.REMOVE for to-many ...
The CascadeTypes REMOVE and ALL, which includes REMOVE, provide a comfortable option to remove an entity together with all its child entities.
Read more >Cascade deletions ignore current state of entities resulting ...
When the parent entity is removed cascade deletes happen immediately by default but ignores changes already made on child entities.
Read more >Disadvantages to using ON DELETE CASCADE on every ...
A thing to keep in mind when using cascades is that it can cause conflicts if there's multiple cascade paths. SQL Server and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In this way, the EntityDeletingEvent can be triggered
Closing since there is a workaround.