arangoclient.net icon indicating copy to clipboard operation
arangoclient.net copied to clipboard

AQL support

Open darinb opened this issue 8 years ago • 5 comments

Removed

darinb avatar Dec 14 '16 20:12 darinb

@darinb sorry if it take long to answer, use db.CreateStatement for raw AQL syntax.

however could you provide the AQL query so that i show you how to convert it to LINQ?

ra0o0f avatar Dec 18 '16 08:12 ra0o0f

The AQL query is:

FOR user IN IdentityUser
FOR login IN user.Logins 
filter login.ProviderKey == providerKey
return user

It works perfect in ArangoDB Web Interface

Thanks

darinb avatar Dec 19 '16 22:12 darinb

equivalent query would be:

    public class IdentityUser
    {
        public List<IdentityProvider> Logins { get; set; }
    }

    public class IdentityProvider
    {
        public string ProviderKey { get; set; }
    }

db.Query<IdentityUser>()
                    .For(user => user.Logins
                    .Where(login => login.ProviderKey == providerKey)
                    .Select(login => user))
                    .ToList();

which translates to:

for `user` in `IdentityUser`
for `login` in  `user`.`Logins`
filter  (  `login`.`ProviderKey`  ==  @P1 )
return   `user`

ra0o0f avatar Dec 20 '16 08:12 ra0o0f

How do you use AQL for delete? I have a complex query which is dynamically generated. So using Linq may be out of the question.

Also, how do you use Linq query without concrete types? For example I have

FOR s IN [{...}, {...}] INSERT s IN Schedules

but I don't have a concrete class which is named Schedule, how do I write a fluent (Linq) expression?

jeff-pang avatar Sep 18 '17 08:09 jeff-pang

@jeff-pang please open a new issue so i can add a label to it if needed. also put your complex query(AQL format) in issue which you want to be write in LINQ.

ra0o0f avatar Sep 18 '17 09:09 ra0o0f