protected override void OnEntityDelete(IEntityCore toDelete, WorkDataCollector workData) { base.OnEntityDelete(toDelete, workData); switch ((EntityType)toDelete.LLBLGenProEntityTypeValue) { case EntityType.OrderEntity: workData.Add(OrderEntity.Relations.OrderAuditInfoEntityUsingOrderId); workData.Add(OrderEntity.Relations.OrderDetailEntityUsingOrderId); break; } }
/// <summary> /// Called when toDelete is about to be deleted. Use this method to specify work to be done by the scope to avoid FK constraint issues. /// workData is meant to collect this work. It can either be additional entities to delete prior to 'toDelete', or a list of /// relations which are used to create cascading delete actions executed prior to the delete action of toDelete. /// </summary> /// <param name="toDelete">To delete.</param> /// <param name="workData">The work data.</param> protected override void OnEntityDelete(IEntityCore toDelete, WorkDataCollector workData) { switch ((EntityType)toDelete.LLBLGenProEntityTypeValue) { case EntityType.OrderEntity: // even though we fetch all order detail rows for an order, we add the relationship so we don't miss // any order details which are added by another user. workData.Add(OrderEntity.Relations.OrderDetailsEntityUsingOrderId); break; } }
/// <summary> /// Called when toDelete is about to be deleted. Use this method to specify work to be done by the scope to avoid FK constraint issues. /// workData is meant to collect this work. It can either be additional entities to delete prior to 'toDelete', or a list of /// relations which are used to create cascading delete actions executed prior to the delete action of toDelete. /// </summary> /// <param name="toDelete">To delete.</param> /// <param name="workData">The work data.</param> protected override void OnEntityDelete(IEntityCore toDelete, WorkDataCollector workData) { switch ((EntityType)toDelete.LLBLGenProEntityTypeValue) { case EntityType.OrderEntity: // only add edge for entities not already in the graph. All order details are in the graph. workData.Add(OrderEntity.Relations.OrderAuditInfoEntityUsingOrderId); // alternatively, we could opt for fetching the data to delete. //var qf = new QueryFactory(); //var q = qf.OrderAuditInfo.Where(OrderAuditInfoFields.OrderId == ((OrderEntity)toDelete).OrderId); //workData.Add(new DataAccessAdapter().FetchQuery(q)); break; case EntityType.CustomerEntity: workData.Add(CustomerEntity.Relations.CustomerCustomerDemoEntityUsingCustomerId); workData.Add(CustomerEntity.Relations.OrderEntityUsingCustomerId); workData.Add(OrderEntity.Relations.OrderDetailEntityUsingOrderId); workData.Add(OrderEntity.Relations.OrderAuditInfoEntityUsingOrderId); break; } }