コード例 #1
0
        public void GroupBySelectAggregation()
        {
            var db = DatabaseGenerator.Get();

            var query = db.Query <Person>().GroupBy(x => x.Age)
                        .Select(byAge => new { len = AQL.Length(byAge), byAge.Key, Ages = byAge.Select(x => x.Age) });

            Assert.Equal(query.GetQueryData().Query.RemoveSpaces(),
                         @"for `x` in `Person` collect `CV1` = `x`.`Age` into `C1` return { `len` : length( `C1` ) , `Key` : `CV1` , `Ages` : ( for `x` in `C1` return `x`.`x`.`Age` )  }".RemoveSpaces());
        }
コード例 #2
0
 public async Task <TUser> FindByLoginAsync(string loginProvider, string providerKey, CancellationToken cancellationToken)
 {
     return(await Database.Query <TUser>()
            .Where(d =>
                   AQL.Length(
                       Database.Query <TUser>()
                       .For(a => a.Logins)
                       .Where(b => b.LoginProvider == loginProvider && b.ProviderKey == providerKey)
                       .Select(c => c)
                       ) != 0
                   )
            .Select(d => d)
            .FirstOrDefaultAsync());
 }
コード例 #3
0
        public void TraversalFilter()
        {
            InitiateGraph();

            var result = db.Query()
                         .Traversal <Person, Follow>(alice.Id)
                         .Depth(1, 6)
                         .Graph(graphName)
                         .Where(g => AQL.Length(
                                    db.Query().For(_ => g.Path.Vertices)
                                    .Where(v => v.Id == charlie.Id)
                                    .Select(v => v))
                                == 0)
                         .Select(g => g.Vertex)
                         .ToList();

            Assert.Equal(2, result.Count);
        }