Skip to content

Commit

Permalink
Enable profiling through RequestBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
tlil committed Aug 16, 2017
1 parent 96a5a1e commit ff14c77
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/GraphQL.Conventions/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
[assembly: AssemblyCopyright("Copyright 2016-2017 Tommy Lillehagen. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.2.14")]
[assembly: AssemblyInformationalVersion("1.2.14")]
[assembly: AssemblyFileVersion("1.2.15")]
[assembly: AssemblyInformationalVersion("1.2.15")]
[assembly: CLSCompliant(false)]

[assembly: InternalsVisibleTo("Tests")]
2 changes: 1 addition & 1 deletion src/GraphQL.Conventions/GraphQL.Conventions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>GraphQL Conventions for .NET</Description>
<VersionPrefix>1.2.14</VersionPrefix>
<VersionPrefix>1.2.15</VersionPrefix>
<Authors>Tommy Lillehagen</Authors>
<TargetFrameworks>netstandard1.5;net45</TargetFrameworks>
<DebugType>portable</DebugType>
Expand Down
14 changes: 14 additions & 0 deletions src/GraphQL.Conventions/Web/RequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class RequestHandlerBuilder : IDependencyInjector

bool _useValidation = true;

bool _useProfiling = false;

bool _outputViolationsAsWarnings;

FieldResolutionStrategy _fieldResolutionStrategy = FieldResolutionStrategy.Normal;
Expand Down Expand Up @@ -107,6 +109,12 @@ public RequestHandlerBuilder WithoutValidation(bool outputViolationsAsWarnings =
return this;
}

public RequestHandlerBuilder WithProfiling(bool profiling = true)
{
_useProfiling = profiling;
return this;
}

public RequestHandlerBuilder WithFieldResolutionStrategy(FieldResolutionStrategy strategy)
{
_fieldResolutionStrategy = strategy;
Expand All @@ -127,6 +135,7 @@ public IRequestHandler Generate()
_assemblyTypes,
_exceptionsTreatedAsWarnings,
_useValidation,
_useProfiling,
_outputViolationsAsWarnings,
_fieldResolutionStrategy,
_complexityConfiguration);
Expand All @@ -148,6 +157,8 @@ class RequestHandlerImpl : IRequestHandler

readonly bool _useValidation;

readonly bool _useProfiling;

readonly bool _outputViolationsAsWarnings;

readonly ComplexityConfiguration _complexityConfiguration;
Expand All @@ -158,6 +169,7 @@ internal RequestHandlerImpl(
IEnumerable<Type> assemblyTypes,
IEnumerable<Type> exceptionsTreatedAsWarning,
bool useValidation,
bool useProfiling,
bool outputViolationsAsWarnings,
FieldResolutionStrategy fieldResolutionStrategy,
ComplexityConfiguration complexityConfiguration)
Expand All @@ -166,6 +178,7 @@ internal RequestHandlerImpl(
_engine.WithAttributesFromAssemblies(assemblyTypes);
_exceptionsTreatedAsWarnings.AddRange(exceptionsTreatedAsWarning);
_useValidation = useValidation;
_useProfiling = useProfiling;
_outputViolationsAsWarnings = outputViolationsAsWarnings;
_engine.WithFieldResolutionStrategy(fieldResolutionStrategy);
_engine.BuildSchema(schemaTypes.ToArray());
Expand Down Expand Up @@ -193,6 +206,7 @@ public async Task<Response> ProcessRequest(Request request, IUserContext userCon
.WithUserContext(userContext)
.WithComplexityConfiguration(_complexityConfiguration)
.EnableValidation(_useValidation)
.EnableProfiling(_useProfiling)
.Execute()
.ConfigureAwait(false);

Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Conventions/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.14-*",
"version": "1.2.15-*",
"description": "GraphQL Conventions for .NET",
"authors": [
"Tommy Lillehagen"
Expand Down

0 comments on commit ff14c77

Please sign in to comment.