public override void OnBeforeDelete(IDeleteRequestHandler handler) { foreach (var info in infoList) { if (!info.Attr.CascadeDelete) { continue; } var thisKey = info.ThisKeyField.AsObject(handler.Row); if (ReferenceEquals(null, thisKey)) { continue; } var oldID = GetExistingID(handler.Connection, info, thisKey); if (oldID == null) { continue; } var deleteHandler = DefaultHandlerFactory.DeleteHandlerFor(info.Attr.RowType); var deleteRequest = DefaultHandlerFactory.DeleteRequestFor(info.Attr.RowType); deleteRequest.EntityId = oldID; deleteHandler.Process(handler.UnitOfWork, deleteRequest); } }
private void DeleteDetail(IUnitOfWork uow, object detailId) { var deleteHandler = DefaultHandlerFactory.DeleteHandlerFor(rowType); var deleteRequest = DefaultHandlerFactory.DeleteRequestFor(rowType); deleteRequest.EntityId = detailId; deleteHandler.Process(uow, deleteRequest); }