public static async Task <LiveDbObject <T> > Save <T>(this T buildFor, Func <IDriver> graphClientFactory) where T : INeo4jNode { LiveDbObject <T> ret = LiveDbObject <T> .Build(buildFor, graphClientFactory, LiveObjectMode.Ignore); await ret.Save(graphClientFactory); return(ret); }
public static LiveDbObject <T> Build(T buildFor, Func <IDriver> graphClient, LiveObjectMode liveMode) { if (buildFor is INeo4jNode) { LiveDbObject <T> tmp = new LiveDbObject <T>(buildFor, graphClient, liveMode); LiveDbObject <T> pooled = livePool.Where(x => { if (Object.ReferenceEquals(x.BackingInstance, buildFor)) { return(true); } string strid = (buildFor as INeo4jNode).Id; if (string.IsNullOrWhiteSpace(strid)) { return(false); } else { return(x["Id"].ToString() == strid); } }).SingleOrDefault(); if (pooled == null) { livePool.Add(tmp); return(tmp); } else { return(pooled); } } //non-INeo4jNode objects don't get pooled return(new LiveDbObject <T>(buildFor, graphClient, liveMode)); }
public static async Task SaveSubnode <T, TValue>(LiveDbObject <T> parent, Property prop, TValue value, Func <IDriver> graphClientFactory)
public static Task <bool> Save <T>(this LiveDbObject <T> buildFor, IDriver graphClient) where T : INeo4jNode { return(buildFor.Save(() => graphClient)); }
public static async Task <bool> Save <T>(this LiveDbObject <T> buildFor, Func <IDriver> graphClientFactory) where T : INeo4jNode { await DBOps.SaveNode(buildFor, graphClientFactory); return(true); }