Skip to content

Mutations with underlying async calls #90

@benmccallum

Description

@benmccallum

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions