Skip to content

Conversation

MarianPalkus
Copy link
Collaborator

I ran into an issue when executing queries against mutation results with Entity Framework when a mutation returns a EF proxy.

Looking at Executor (line 19ff):

public static object Execute
    (GraphQLSchema<TContext> schema, TContext context, GraphQLField field, ExecSelection<Info> query)
{
    var mutReturn = field.RunMutation(context, query.Arguments.Values());

    var queryableFuncExpr = field.GetExpression(query.Arguments.Values(), mutReturn);
    var replaced = (LambdaExpression)ParameterReplacer.Replace(queryableFuncExpr, queryableFuncExpr.Parameters[0], GraphQLSchema<TContext>.DbParam);

    // sniff queryable provider to determine how selector should be built
    var dummyQuery = replaced.Compile().DynamicInvoke(context, null);
    var queryType = dummyQuery.GetType();

In this case the queryType is System.Data.Entity.DynamicProxies, but we are interested in the queryType.BaseType.

This PR adds an expression option to handle this.

@MarianPalkus
Copy link
Collaborator Author

@ckimes89 will you find time to look at this PR or shall i merge it?

@chkimes chkimes merged commit 23f7456 into chkimes:master Oct 1, 2017
@MarianPalkus MarianPalkus deleted the ef-mutation-result branch October 2, 2017 06:58
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

Successfully merging this pull request may close these issues.

2 participants