public override void Apply(ReadonlyGraph graph) { V dbItem = DbItem; if (dbItem == null) { throw new InvalidOperationException($"vertex {Item.GetType().Name} with @rid = {Item.Rid} was not exists"); } Sets.ForEach(p => p(Item)); }
public override void Apply(ReadonlyGraph graph) { V dbItem = DbItem; if (dbItem == null) { throw new InvalidOperationException($"vertex {Item.GetType().Name} was not created"); } Item.Rid = DbItem.Rid; graph.GraphItems[Item.GetType()].Add(Item); }
public override void Apply(ReadonlyGraph graph) { E dbItem = DbItem; if (dbItem != null) { throw new InvalidOperationException($"edge {Item.GetType().Name} with @rid = {Item.Rid} was not deleted"); } Item.FromV.OutE.Remove(Item); Item.ToV.InE.Remove(Item); var items = graph.GraphItems[Item.GetType()]; var item = items.FirstOrDefault(p => p.Rid == Item.Rid); items.Remove(item); }
public override void Apply(ReadonlyGraph graph) { E dbItem = DbItem; if (dbItem == null) { throw new InvalidOperationException($"edge {Item.GetType().Name} with @rid = {Item.Rid} was not exists"); } Item.FromV.OutE.Remove(Item); Item.ToV.InE.Remove(Item); Sets.ForEach(p => p(Item)); Item.FromV.OutE.Add(Item); Item.ToV.InE.Add(Item); }
public override void Apply(ReadonlyGraph graph) { V dbItem = DbItem; if (dbItem != null) { throw new InvalidOperationException($"vertex {Item.GetType().Name} with @rid = {Item.Rid} was not deleted"); } var items = graph.GraphItems[Item.GetType()]; var item = items.FirstOrDefault(p => p.Rid == Item.Rid) as V; var edges = item?.Both() .SelectMany(p => new [] { p.FromV, p.ToV }) .ToList() ?? new List <V>(); edges.ForEach(p => graph.GraphItems[p.GetType()].Remove(p)); items.Remove(item); }
public async Task Setup(bool force = false) { var connection = await GetConnection(); if (!_setuped) { var setup = new GraphSetup(connection, _restClient); Setup(setup); _graph = new ReadonlyGraph(setup); } if (!_setuped || force) { if (_settings.Mode == Mode.WriteThrough) { await _graph.Prepare(); } } _setuped = true; }
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); }
public abstract void Apply(ReadonlyGraph graph);
public MutableGraph(ReadonlyGraph graph) { _graph = graph; _mutations = new List <IGraphMutation>(); _factory = new IdentifierFactory(); }