Exemple #1
0
        /// <summary>
        /// Changes an existing relation's source, destination and ordinal
        /// </summary>
        /// <param name="session"></param>
        /// <param name="originalRelation"></param>
        /// <param name="newSourceId"></param>
        /// <param name="newDestinationId"></param>
        /// <param name="newOrdinal"></param>
        public static void ChangeRelation(this ICoreRelationsRepository session, IRelationById originalRelation, HiveId newSourceId, HiveId newDestinationId, int newOrdinal = int.MinValue)
        {
            session.RemoveRelation(originalRelation);
            var useOrdinal = newOrdinal == int.MinValue ? originalRelation.Ordinal : newOrdinal;

            session.AddRelation(new Relation(originalRelation.Type, newSourceId, newDestinationId, useOrdinal, originalRelation.MetaData.ToArray()));
        }
Exemple #2
0
 /// <summary>
 /// Updates a relation to be of a new relation type
 /// </summary>
 /// <param name="session"></param>
 /// <param name="originalRelation"></param>
 /// <param name="newRelationType"></param>
 public static void ChangeRelationType(this ICoreRelationsRepository session, IRelationById originalRelation, RelationType newRelationType)
 {
     session.RemoveRelation(originalRelation);
     session.AddRelation(new Relation(newRelationType, originalRelation.SourceId, originalRelation.DestinationId, originalRelation.Ordinal, originalRelation.MetaData.ToArray()));
 }
Exemple #3
0
 public static void AddRelation(this ICoreRelationsRepository session, HiveId sourceId, HiveId destinationId, AbstractRelationType relationType, int ordinal, params RelationMetaDatum[] metaData)
 {
     session.AddRelation(new Relation(relationType, sourceId, destinationId, ordinal, metaData));
 }
Exemple #4
0
 public static void AddRelation(this ICoreRelationsRepository session, IRelatableEntity source, IRelatableEntity destination, AbstractRelationType relationType, int ordinal, params RelationMetaDatum[] metaData)
 {
     session.AddRelation(new Relation(relationType, source, destination, ordinal, metaData));
 }