Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutations with underlying async calls #90

Open
benmccallum opened this issue Mar 8, 2018 · 0 comments
Open

Mutations with underlying async calls #90

benmccallum opened this issue Mar 8, 2018 · 0 comments

Comments

@benmccallum
Copy link
Contributor

benmccallum commented Mar 8, 2018

In the EF examples (in EntityFrameworkExecutionTests for instance), you're using context.SaveChanges() inside your "addMutate" mutation meaning your mutation parameter in the schema.AddMutation(...) signature can just be synchronous. What if you want to use context.SaveChangesAsync() though? Or, in my situation with CosmosDB, what if your underlying data storage API only has async methods?

Seems like I can add async to the mutation and await the CosmosDB call, but then I have to force blocking for .Result.
image

The queryableGetter can't be marked as async as Async lambda expressions cannot be converted into expression trees.
image
(Worth noting that using a method body won't fit anyway as it also can't be converted to an expression tree).

I get that the mutation has to happen and be waited on before the retrieval query can fire after, but I'm just wondering whether you can have overloads for AddMutation that support async?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant