Esempio n. 1
0
        public void DeleteRelationship(RelationshipRecord relationship) {
            if (relationship == null) {
                return;
            }

            if (relationship.Type == (byte) RelationshipType.OneToMany) {
                var entity = _contentMetadataService.GetDraftEntity(relationship.RelatedEntity.Name);
                var record = _oneToManyRepository.Get(x => x.Relationship.Name == relationship.Name
                    && x.Relationship.RelatedEntity.ContentItemVersionRecord.Latest);
                var field = entity.FieldMetadataRecords.First(x => x.Name == record.LookupField.Name);
                entity.FieldMetadataRecords.Remove(field);
                DeleteRelationship(record);
            }
            else if (relationship.Type == (byte) RelationshipType.ManyToMany) {
                var record = _manyToManyRepository.Get(x => x.Relationship == relationship);
                DeleteRelationship(record);
            }
        }
Esempio n. 2
0
 private RelationshipRecord CreateRelation(RelationshipRecord relationship) {
     _relationshipRepository.Create(relationship);
     return relationship;
 }
Esempio n. 3
0
 public void DeleteRelationship(RelationshipRecord relationship) {
     if (relationship == null) {
         return;
     }
     if (relationship.Type == (byte) RelationshipType.OneToMany) {
         var record = _oneToManyRepository.Get(x => x.Relationship == relationship);
         DeleteRelationship(record);
     }
     else if (relationship.Type == (byte) RelationshipType.ManyToMany) {
         var record = _manyToManyRepository.Get(x => x.Relationship == relationship);
         DeleteRelationship(record);
     }
 }