Skip to content

Commit 94a80d4

Browse files
authored
Prevent GraphQL.NET 8 reflection caching (#27)
* Prevent GraphQL.NET 8 reflection caching * update
1 parent c144488 commit 94a80d4

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Sample/Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<NoWarn>$(NoWarn);1701;1702;CS1591</NoWarn>
66
</PropertyGroup>
77

src/GraphQL.DI/DIObjectGraphType.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Linq.Expressions;
23
using System.Reflection;
34
using GraphQL.Types;
@@ -20,6 +21,13 @@ public class DIObjectGraphType<TDIGraph> : DIObjectGraphType<TDIGraph, object> w
2021
public class DIObjectGraphType<TDIGraph, TSource> : AutoRegisteringObjectGraphType<TSource>
2122
where TDIGraph : IDIObjectGraphBase<TSource>
2223
{
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="DIObjectGraphType{TDIGraph, TSource}"/> class.
26+
/// </summary>
27+
public DIObjectGraphType() : base(Array.Empty<Expression<Func<TSource, object?>>>()) // prevent GraphQL.NET 8 reflection caching
28+
{
29+
}
30+
2331
/// <inheritdoc/>
2432
protected override void ConfigureGraph()
2533
{

src/Tests/Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<RootNamespace/>
66
<NoWarn>$(NoWarn);1701;1702;1591;IDE1006;IDE0060;0618;CA1707;CA1822;CS1591;CA1861;IDE0022;IDE0021;IDE0028;CA1852</NoWarn>
77
</PropertyGroup>

0 commit comments

Comments
 (0)