コード例 #1
0
        public ValidationResult CollectValidationResultBeforeDelete(Folder folder)
        {
            ValidationResult         validationResult   = new ValidationResult();
            List <Guid>              folderIds          = _folderRepository.FindAllSubFolderIds(folder.Id);
            List <CompositeType>     compositeTypes     = _compositeTypeRepository.FindCompositeTypesToFolderIds(folderIds);
            List <ValidationMessage> validationMessages = CollectInvalidCompositeTypesUsedInSuperTypesValidationMessages(folderIds, compositeTypes);

            validationMessages.AddRange(CollectInvalidCompositeTypesOwnerOfCompositeTypeElementsUsedAsElementType(folderIds, compositeTypes));
            validationResult.AddRange(validationMessages);
            return(validationResult);
        }
コード例 #2
0
        protected override void DoDelete(Folder folder)
        {
            List <Guid> folderAndSubFolderIds = _folderRepository.FindAllSubFolderIds(folder.Id);
            List <Guid> compositeTypeIds      = _compositeTypeRepository.FindCompositeTypeIdsToFolderIds(folderAndSubFolderIds);
            List <Guid> presetIds             = _presetRepository.FindPresetIdsToCompositeTypeIds(compositeTypeIds);

            _genericRepository.DeleteRange <CompositePresetElement>(x => presetIds.Contains(x.OwningPresetId));
            _genericRepository.DeleteRange <CompositeTypeElement>(x => compositeTypeIds.Contains(x.OwningTypeId));
            _genericRepository.DeleteRange <Preset>(x => compositeTypeIds.Contains(x.TypeId));
            _genericRepository.DeleteRange <CompositeType>(x => compositeTypeIds.Contains(x.Id));
            DeleteAllSubFolders(folder.Id);
        }