From 59379f3c11255e4a515dd0f8a6b00129f4acc43e Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Fri, 29 Nov 2024 17:55:47 +0100 Subject: [PATCH] Fixed .NET compatibility of ported features. (#7782) --- .../AspNetCore.Authorization/DefaultAuthorizationHandler.cs | 3 ++- .../src/Types/Types/Directives/SemanticNonNullDirective.cs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization/DefaultAuthorizationHandler.cs b/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization/DefaultAuthorizationHandler.cs index bcc15389477..4101cb2a9e8 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization/DefaultAuthorizationHandler.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization/DefaultAuthorizationHandler.cs @@ -43,8 +43,9 @@ public DefaultAuthorizationHandler( throw new ArgumentNullException(nameof(authorizationPolicyProvider)); _authorizationPolicyCache = authorizationPolicyCache ?? throw new ArgumentNullException(nameof(authorizationPolicyCache)); - +#if NET7_0_OR_GREATER _canCachePolicies = _authorizationPolicyProvider.AllowsCachingPolicies; +#endif } /// diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/SemanticNonNullDirective.cs b/src/HotChocolate/Core/src/Types/Types/Directives/SemanticNonNullDirective.cs index 1f64e212a95..d6f47c4e8ac 100644 --- a/src/HotChocolate/Core/src/Types/Types/Directives/SemanticNonNullDirective.cs +++ b/src/HotChocolate/Core/src/Types/Types/Directives/SemanticNonNullDirective.cs @@ -5,7 +5,11 @@ namespace HotChocolate.Types; [DirectiveType(WellKnownDirectives.SemanticNonNull, DirectiveLocation.FieldDefinition, IsRepeatable = false)] public sealed class SemanticNonNullDirective(IReadOnlyList levels) { +#if NETSTANDARD2_0 + [GraphQLType(typeof(ListType>))] +#else [GraphQLType>>] +#endif [DefaultValueSyntax("[0]")] public IReadOnlyList? Levels { get; } = levels; }