public void SetRelation(Entity source, Entity target, RelationShipDescriptor property) { // Fixme optim: var state = GetState(Staging); if (!state.Entities.Any(e => e == source)) { throw new Exception($"missing entity {source.Id}"); } if (!state.Entities.Any(e => e == target)) { throw new Exception($"missing entity {target.Id}"); } Staging.RelationShips.Add(new RelationShip <Entity, Entity, RelationShipDescriptor>(source, target, property)); }
public Value CreateValue(Entity entity, RelationShipDescriptor property, string data, string type = "") { var value = new Value { Data = data, Id = (_idValue++).ToString(), Type = type }; Staging.OwnerShips.Add( new RelationShip <Value, Entity, RelationShipDescriptor>( value, entity, property ) ); Staging.Values.Add(value); return(value); }