Example #1
0
        public Relation SetRelation(ChatUser target, Relation.Type relationType, bool isSource = true)
        {
            if (target == null)
            {
                throw new ArgumentNullException("Target must not be null!");
            }

            Relation relation;
            Guid     relationID;

            if (this.Relationship.ContainsKey(target.ID))
            {
                this.Relationship.TryGetValue(target.ID, out relationID);
                relation = Relation.Get(relationID);
            }
            else
            {
                relation = new Relation(this.ID, target.ID, 1);
                this.Relationship.Add(target.ID, relation.ID);
                target.Relationship.Add(this.ID, relation.ID);
                this.Save();
                target.Save();
            }

            relation.RelationType = relationType;
            relation.Save();

            return(relation);
        }
Example #2
0
 public AddRelationCommand(ObservableCollection <Relation> relations, Klass klass1, Klass klass2,
                           Relation.Type relationType)
 {
     _klass1    = klass1;
     _klass2    = klass2;
     _relation  = new Relation(relationType);
     _relations = relations;
 }
Example #3
0
 private void AddCompostion()
 {
     _relationType = Relation.Type.Composition;
     AddRelation();
 }
Example #4
0
 private void AddInheritance()
 {
     _relationType = Relation.Type.Inheritance;
     AddRelation();
 }
Example #5
0
 private void AddReference()
 {
     _relationType = Relation.Type.Reference;
     AddRelation();
 }