/// <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())); }
/// <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())); }
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)); }
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)); }