ra0o0f / arangoclient.net

ArangoDB .NET Client with LINQ support
Apache License 2.0
99 stars 37 forks source link

AQL support #61

Open darinb opened 7 years ago

darinb commented 7 years ago

Removed

ra0o0f commented 7 years ago

@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?

darinb commented 7 years ago

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

ra0o0f commented 7 years ago

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`
jeff-pang commented 7 years ago

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?

ra0o0f commented 7 years ago

@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.