public async Task <TValue> Get <TValue>(Expression <Func <T, TValue> > expression) { var member = (expression.Body as MemberExpression).Member as PropertyInfo; var prop = PropCache.props[member.Name]; if ((LiveMode & LiveObjectMode.LiveRead) != 0) { IEnumerable <LiveDbObject <T> > results = (await Neo4jSet <T> .All(GraphClientFactory).Include(expression).ReturnAsync()).ToList(); IEnumerable <LiveDbObject <T> > filtered = results.Where(x => x["Id"] == this["Id"]).ToList(); TValue[] vals = await Task.WhenAll(filtered.Select(x => { LiveObjectMode oldMode = x.LiveMode; x.LiveMode = LiveObjectMode.Ignore; var ret = x.Get(expression); x.LiveMode = oldMode; return(ret); })); TValue remote = vals.SingleOrDefault(); if (!remote.Equals(default))
public async Task TestInsertStyle() { Style s = new Style(); s.Id = (new Guid(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)).ToString("n"); s.Name = "Concrete"; s.Category.Add(Category.Bags, AcceptanceState.Suggested); s.Category.Add(Category.Headwear, AcceptanceState.Suggested); s.Category.Add(Category.Legging, AcceptanceState.Suggested); s.WaistLine.Add(new List <float>(new float[] { 0, 1, 2.2f }), AcceptanceState.Suggested); Color c = new Color(); c.Id = (new Guid(100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90)).ToString("n"); c.Hex.Add("ABC123", AcceptanceState.Suggested); Color c2 = new Color(); c2.Id = (new Guid(50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40)).ToString("n"); c2.Hex.Add("DEF987", AcceptanceState.Accepted); c.Template.Add(c2, AcceptanceState.RolledBack); s.Colors.Add(new List <Color>(new Color[] { c }), AcceptanceState.Suggested); s.Template = new Style() { Name = "Template", Id = (new Guid(10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)).ToString("n"), Template = new Style() { Id = (new Guid(20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30)).ToString("n"), Name = "Super Template" } }; await s.Save(Client); var a = Neo4jSet <Style> .All(Client) .Include(x => x.Template.Template) .Include(x => x.Category.Start.Value) .Include(x => x.Category.Start.Next.Value) .Include(x => x.Category.Start.Next.Next.Value) .Include(x => x.Colors) .ThenInclude(x => x.Start) .ThenInclude(x => x.Value) .Include(x => x.Colors) .ThenInclude(x => x.Start) .ThenInclude(x => x.Next) .ThenInclude(x => x.Value) .ThenIncludeCollection(x => x, x => x.Hex) .ThenInclude(x => x.Start) .ThenInclude(x => x.Next) .ThenInclude(x => x.Value) //.Where(x => x.Id == (new Guid(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)).ToString("n")); ; LiveDbObject <Style>[] sOut = (await a.ReturnAsync()).ToArray(); Style[] sCache = sOut.Select(x => x.BackingInstance).ToArray(); LiveDbObject <Style> templt = sOut.Single(x => { x.LiveMode = LiveObjectMode.Live; return(x.Get(y => y.Name).Result == "Template"); }); await templt.Call(x => x.Colors, (y, a) => y.Add(a, AcceptanceState.Suggested), new List <Color>() { c2 } as ICollection <Color>); LiveDbObject <Style> suprTemplt = sOut.Single(x => { x.LiveMode = LiveObjectMode.Live; return(x.Get(y => y.Name).Result == "Super Template"); }); Color c3 = new Color(); c3.Hex.Add("dahex", AcceptanceState.RolledBack); c3.Template.Add(c2, AcceptanceState.Finalized); await suprTemplt.Call(x => x.Colors, (y, a) => y.Add(a, AcceptanceState.Suggested), new List <Color>() { c, c2, c3 } as ICollection <Color>); }
public async Task TestGetAllNodes() { var a = await Neo4jSet <INeo4jNode> .All(Client).ReturnAsync(); }