예제 #1
0
        /// <summary>
        /// Adds a parent child relationship between the two persons and applies the specified fact.
        /// </summary>
        /// <param name="parent">The parent person state.</param>
        /// <param name="child">The child person state.</param>
        /// <param name="fact">The fact to apply when the relationship is created.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="RelationshipState"/> instance containing the REST API response.
        /// </returns>
        public RelationshipState AddParentChildRelationship(PersonState parent, PersonState child, Fact fact, params IStateTransitionOption[] options)
        {
            Relationship relationship = new Relationship();

            relationship.Person1   = new ResourceReference(parent.GetSelfUri());
            relationship.Person2   = new ResourceReference(child.GetSelfUri());
            relationship.KnownType = RelationshipType.ParentChild;
            relationship.AddFact(fact);
            return(AddRelationship(relationship, options));
        }
예제 #2
0
        /// <summary>
        /// Adds a spouse relationship between the two persons and applies the specified fact.
        /// </summary>
        /// <param name="person1">The first person to which a relationship will be added (e.g., a husband).</param>
        /// <param name="person2">The second person to which a relationship will be added (e.g., a wife).</param>
        /// <param name="fact">The fact to apply when the relationship is created.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="RelationshipState"/> instance containing the REST API response.
        /// </returns>
        public RelationshipState AddSpouseRelationship(PersonState person1, PersonState person2, Fact fact, params IStateTransitionOption[] options)
        {
            Relationship relationship = new Relationship();

            relationship.Person1   = new ResourceReference(person1.GetSelfUri());
            relationship.Person2   = new ResourceReference(person2.GetSelfUri());
            relationship.KnownType = RelationshipType.Couple;
            relationship.AddFact(fact);
            return(AddRelationship(relationship, options));
        }