Esempio n. 1
0
        private void DeleteRelationship(ManyToManyRelationshipRecord record)
        {
            if (record == null)
            {
                return;
            }
            record.PrimaryListProjection.QueryPartRecord.Layouts.Clear();
            record.PrimaryListProjection.QueryPartRecord.FilterGroups.Clear();
            record.RelatedListProjection.QueryPartRecord.Layouts.Clear();
            record.RelatedListProjection.QueryPartRecord.FilterGroups.Clear();
            _manyToManyRepository.Delete(record);
            _relationshipRepository.Delete(record.Relationship);

            string primaryName = record.Relationship.PrimaryEntity.Name;
            string relatedName = record.Relationship.RelatedEntity.Name;

            _schemaUpdateService.DropCustomTable(string.Format("Coevery_DynamicTypes_{0}ContentLinkRecord", record.Relationship.Name));
            _schemaUpdateService.DropCustomTable(string.Format("Coevery_DynamicTypes_{0}{1}PartRecord", record.Relationship.Name, primaryName));
            _schemaUpdateService.DropCustomTable(string.Format("Coevery_DynamicTypes_{0}{1}PartRecord", record.Relationship.Name, relatedName));

            _contentDefinitionManager.DeletePartDefinition(record.Relationship.Name + primaryName + "Part");
            _contentDefinitionManager.DeletePartDefinition(record.Relationship.Name + relatedName + "Part");

            _dynamicAssemblyBuilder.Build();
        }