UNPKG

bc-code-intelligence-mcp

Version:

BC Code Intelligence MCP Server - Complete Specialist Bundle with AI-driven expert consultation, seamless handoffs, and context-preserving workflows

92 lines (67 loc) 4.88 kB
--- title: "DeleteAll Alternative Implementation" domain: "sam-coder" difficulty: "advanced" bc_versions: "14+" tags: ["deleteall", "alternatives", "implementation", "patterns"] samples: "samples/deleteall-alternative-implementation.md" --- # DeleteAll Alternative Implementation ## Overview While DeleteAll provides comprehensive business logic enforcement through OnDelete trigger execution, many scenarios require alternative approaches that prioritize performance, custom logic, or specific operational requirements. **Key Consideration**: Alternative implementations trade business logic automation for performance or flexibility - this trade-off must align with specific business requirements. **Common Scenarios for Alternatives**: - High-performance bulk operations where trigger execution creates unacceptable delays - Custom business logic requirements that extend beyond standard OnDelete trigger capabilities - Integration scenarios requiring specialized error handling and recovery mechanisms - Complex data transformation operations during deletion processes ## Strategic Implementation Approaches ### Direct Database Operations **SQL DELETE Operations**: Maximum performance approach bypassing all BC business logic layer processing. **Use Case Scenarios**: - Simple cleanup operations on isolated tables without related data dependencies - System maintenance operations where business rule enforcement is unnecessary - Temporary data removal where audit trails and logging are not required - Performance-critical operations where trigger execution overhead is prohibitive **Risk Assessment**: - Data integrity violations possible if business logic requirements are misunderstood - Related table orphaned data creation if cleanup logic is inadequate - Compliance violation potential if audit trail requirements are not properly implemented - Future maintenance complexity increases with custom implementation scope ### Custom Deletion Procedures **Controlled Business Logic Implementation**: Selective implementation of essential business logic with performance optimization. **Design Patterns**: - Extract critical OnDelete trigger logic into dedicated validation procedures - Implement batch processing patterns for large dataset operations with progress tracking - Design custom error handling and recovery mechanisms for specific operational scenarios - Create specialized audit and logging procedures tailored to deletion operation requirements **Performance Optimization Techniques**: - Batch record processing to reduce database round-trip overhead - Optimized transaction boundary management for improved throughput - Progress tracking and user communication for long-running operations - Parallel processing implementation where business logic constraints permit ### Hybrid Approaches **Selective DeleteAll Usage**: Combining DeleteAll with alternative approaches based on operation characteristics. **Conditional Logic Implementation**: - Use DeleteAll for small datasets where performance impact is acceptable - Implement custom logic for large datasets requiring performance optimization - Apply different strategies based on table complexity and related data relationships - Design fallback mechanisms for error conditions and exceptional scenarios ## Implementation Framework ### Requirements Analysis - Catalog all OnDelete trigger logic and classify by criticality to business operations - Identify related table relationships and cascade operation requirements - Assess audit trail and compliance logging requirements for deletion operations - Define acceptable performance thresholds for different types of deletion operations ### Architecture Design - Design modular deletion procedure architecture supporting multiple implementation strategies - Implement configuration-driven approach enabling runtime selection of deletion methods - Create standardized interfaces for deletion operations supporting consistent error handling - Plan integration with existing BC business logic and validation procedures ## Anti-Patterns ### Business Logic Neglect **Dangerous Oversimplification**: Implementing alternatives without proper business logic consideration. Bypassing essential validation logic creates data integrity risks and compliance violations. ### Performance Assumption Errors **Premature Optimization**: Implementing complex alternatives without validating DeleteAll performance limitations. Thoroughly evaluate DeleteAll performance before committing to alternative implementation effort. ### Incomplete Implementation **Partial Logic Implementation**: Creating alternatives that inadequately replace DeleteAll functionality. Ensure alternative solutions provide equivalent functionality where business requirements demand it.