Exemple #1
0
        /// <summary>
        /// Changes an existing relation's source, destination and ordinal
        /// </summary>
        /// <param name="session"></param>
        /// <param name="originalSourceId"></param>
        /// <param name="originalDestinationId"></param>
        /// <param name="withRelationType"></param>
        /// <param name="newSourceId"></param>
        /// <param name="newDestinationId"></param>
        /// <param name="newOrdinal"></param>
        public static void ChangeRelation(this ICoreRelationsRepository session, HiveId originalSourceId, HiveId originalDestinationId, RelationType withRelationType, HiveId newSourceId, HiveId newDestinationId, int newOrdinal = int.MinValue)
        {
            var findRelation = session.FindRelation(originalSourceId, originalDestinationId, withRelationType);

            if (findRelation != null)
            {
                session.ChangeRelation(findRelation, newSourceId, newDestinationId, newOrdinal);
            }
        }
Exemple #2
0
        public static void ChangeOrCreateRelationMetadata(this ICoreRelationsRepository session, HiveId withSourceId, HiveId withDestinationId, RelationType withRelationType, params RelationMetaDatum[] newMetadata)
        {
            var findRelation = session.FindRelation(withSourceId, withDestinationId, withRelationType) ??
                               new Relation(withRelationType, withSourceId, withDestinationId, 0, newMetadata);

            findRelation.MetaData.Clear();
            newMetadata.ForEach(x => findRelation.MetaData.Add(x));
            session.ChangeRelation(findRelation, findRelation.SourceId, findRelation.DestinationId);
        }