private async Task HandleOperationRequest(HttpContext httpContext) { var payload = Deserialize <RequestPayload>(httpContext.Request.Body); if (payload.OperationName == "IntrospectionQuery") { await HandleIntrospectionQuery(payload, httpContext); return; } ExecutionResult result; try { try { var context = await _graphContextFactory.CreateAsync(payload); httpContext.Features.Set <IGraphContextFeature>(new GraphContextFeature(context)); result = await _executor.ExecuteAsync(context); } catch (Exception ex) { if (_logger.IsEnabled(LogLevel.Error)) { _log4Error(_logger, DateTimeOffset.Now, payload.OperationName, ErrorFormatter.Instance.Format(ex), null); } result = ExecutionResult.Fail(ex); } httpContext.Response.ContentType = "application/json"; var settings = new JsonSerializerSettings { Converters = new List <JsonConverter> { new StringEnumConverter() }, NullValueHandling = NullValueHandling.Ignore }; if (_graphOptions.FieldNameConverter == FieldNameConverter.CamelCase) { settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); } await httpContext.Response.WriteAsync(JsonConvert.SerializeObject(result, Formatting.None, settings)); } catch (Exception ex) { if (_logger.IsEnabled(LogLevel.Error)) { _log4Error(_logger, DateTimeOffset.Now, payload.OperationName, ErrorFormatter.Instance.Format(ex), null); } throw; } }