// Transform (db, args, mut) => db.Entities.First(args) into args => db => db.Entities.First(args) private static GraphQLFieldBuilder <TContext, TEntity> AddMutation <TContext, TArgs, TEntity, TMutReturn>(this GraphQLSchema <TContext> context, string name, Expression <Func <TContext, TArgs, TMutReturn, TEntity> > queryableGetter, Func <TContext, TArgs, TMutReturn> mutation) { var innerLambda = Expression.Lambda <Func <TContext, TEntity> >(queryableGetter.Body, queryableGetter.Parameters[0]); var info = GetQueryInfo(innerLambda); if (info.ResolutionType != ResolutionType.Unmodified) { return(context.AddMutationInternal(name, GetFinalMutationFunc <TContext, TArgs, TMutReturn, IEnumerable <TEntity> >(info.BaseQuery, queryableGetter.Parameters[1], queryableGetter.Parameters[2]), info.ResolutionType, mutation)); } return(context.AddUnmodifiedMutationInternal(name, GetFinalMutationFunc <TContext, TArgs, TMutReturn, TEntity>(info.OriginalQuery, queryableGetter.Parameters[1], queryableGetter.Parameters[2]), mutation)); }