public bool DeepDelete(SpecificationTestColumnLayout entity) { bool success = false; // Create a Transaction TransactionManager DbTransactionManager = new TransactionManager(DbConnectionString); try { // First We should Deep Load All Child Objects Type[] ChildObjects = new Type[] { typeof(TList) }; DeepLoad(entity, true, DeepLoadType.IncludeChildren, ChildObjects); // Start Transaction DbTransactionManager.BeginTransaction(); // Try Deleting Children if (DataRepository.TestColumnObjectLayoutDAL.Delete(DbTransactionManager, entity.TestColumnObjectLayoutCollection) == entity.TestColumnObjectLayoutCollection.Count) { // Try Deleting the Parent if (DataRepository.SpecificationTestColumnLayoutDAL.Delete(DbTransactionManager, entity)) { // Yeah Do the Commit success = true; DbTransactionManager.Commit(); } else { // Cancel this attempt DbTransactionManager.Rollback(); } } else { // Cancel this attempt DbTransactionManager.Rollback(); } } catch (Exception ex) { // Cancel this attempt DbTransactionManager.Rollback(); throw ex; } finally { // Destroy the Transaction DbTransactionManager.Dispose(); } // Return return success; }