コード例 #1
0
        public void AddLink(Guid linkedId, LinkedParticipantType linkType)
        {
            var existingLink = LinkedParticipants.SingleOrDefault(x => x.LinkedId == linkedId && x.Type == linkType);

            if (existingLink != null)
            {
                throw new DomainRuleException("LinkedParticipant", "Participant is already linked with the same link type");
            }
            LinkedParticipants.Add(new LinkedParticipant(Id, linkedId, linkType));
        }
コード例 #2
0
        public void RemoveLink(LinkedParticipant linkedParticipant)
        {
            var link = LinkedParticipants.SingleOrDefault(
                x => x.LinkedId == linkedParticipant.LinkedId && x.Type == linkedParticipant.Type);

            if (link == null)
            {
                throw new DomainRuleException("LinkedParticipant", "Link does not exist");
            }

            LinkedParticipants.Remove(linkedParticipant);
        }
コード例 #3
0
 public void RemoveAllLinks()
 {
     LinkedParticipants.Clear();
 }