예제 #1
0
        public override void Apply(ReadonlyGraph graph)
        {
            E dbItem = DbItem;

            if (dbItem == null)
            {
                throw new InvalidOperationException($"edge {Item.GetType().Name} was not created");
            }

            Item.FromV = graph.FindById(DbItem.FromRid) as V ?? throw  new NullReferenceException();
            Item.ToV   = graph.FindById(DbItem.ToRid) as V ?? throw  new NullReferenceException();

            Item.In  = Item.ToV.Rid;
            Item.Out = Item.FromV.Rid;

            Item.FromV.OutE.Add(Item);
            Item.ToV.InE.Add(Item);

            Item.Rid = DbItem.Rid;
            graph.GraphItems[Item.GetType()].Add(Item);
        }