|
| 1 | +# Infer_Dictionary_As_List_Of_KeyValuePair |
| 2 | + |
| 3 | +## HotChocolateTypeModule.735550c.g.cs |
| 4 | + |
| 5 | +```csharp |
| 6 | +// <auto-generated/> |
| 7 | +
|
| 8 | +#nullable enable |
| 9 | +#pragma warning disable |
| 10 | + |
| 11 | +using System; |
| 12 | +using System.Runtime.CompilerServices; |
| 13 | +using HotChocolate; |
| 14 | +using HotChocolate.Types; |
| 15 | +using HotChocolate.Execution.Configuration; |
| 16 | + |
| 17 | +namespace Microsoft.Extensions.DependencyInjection |
| 18 | +{ |
| 19 | + public static partial class TestsTypesRequestExecutorBuilderExtensions |
| 20 | + { |
| 21 | + public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) |
| 22 | + { |
| 23 | + builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( |
| 24 | + "Tests::TestNamespace.Query", |
| 25 | + global::HotChocolate.Types.OperationTypeNames.Query, |
| 26 | + () => global::TestNamespace.Query.Initialize)); |
| 27 | + builder.ConfigureSchema( |
| 28 | + b => b.TryAddRootType( |
| 29 | + () => new global::HotChocolate.Types.ObjectType( |
| 30 | + d => d.Name(global::HotChocolate.Types.OperationTypeNames.Query)), |
| 31 | + HotChocolate.Language.OperationType.Query)); |
| 32 | + return builder; |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +``` |
| 38 | + |
| 39 | +## Query.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs |
| 40 | + |
| 41 | +```csharp |
| 42 | +// <auto-generated/> |
| 43 | +
|
| 44 | +#nullable enable |
| 45 | +#pragma warning disable |
| 46 | + |
| 47 | +using System; |
| 48 | +using System.Runtime.CompilerServices; |
| 49 | +using HotChocolate; |
| 50 | +using HotChocolate.Types; |
| 51 | +using HotChocolate.Execution.Configuration; |
| 52 | +using Microsoft.Extensions.DependencyInjection; |
| 53 | +using HotChocolate.Internal; |
| 54 | + |
| 55 | +namespace TestNamespace |
| 56 | +{ |
| 57 | + internal static partial class Query |
| 58 | + { |
| 59 | + internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) |
| 60 | + { |
| 61 | + var extension = descriptor.Extend(); |
| 62 | + var configuration = extension.Configuration; |
| 63 | + var thisType = typeof(global::TestNamespace.Query); |
| 64 | + var bindingResolver = extension.Context.ParameterBindingResolver; |
| 65 | + var resolvers = new __Resolvers(); |
| 66 | + |
| 67 | + HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration( |
| 68 | + extension.Context, |
| 69 | + descriptor, |
| 70 | + null, |
| 71 | + new global::HotChocolate.Types.QueryTypeAttribute()); |
| 72 | + configuration.ConfigurationsAreApplied = true; |
| 73 | + |
| 74 | + var naming = descriptor.Extend().Context.Naming; |
| 75 | + |
| 76 | + descriptor |
| 77 | + .Field(naming.GetMemberName("Stuff", global::HotChocolate.Types.MemberKind.ObjectField)) |
| 78 | + .ExtendWith(static (field, context) => |
| 79 | + { |
| 80 | + var configuration = field.Configuration; |
| 81 | + var typeInspector = field.Context.TypeInspector; |
| 82 | + var bindingResolver = field.Context.ParameterBindingResolver; |
| 83 | + var naming = field.Context.Naming; |
| 84 | + |
| 85 | + configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( |
| 86 | + typeInspector.GetTypeRef(typeof(global::System.Collections.Generic.KeyValuePair<int, string>), HotChocolate.Types.TypeContext.Output), |
| 87 | + new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__System_Collections_Generic_KeyValuePairOfintAndstring"))))); |
| 88 | + configuration.ResultType = typeof(global::System.Collections.Generic.Dictionary<int, string?>); |
| 89 | + |
| 90 | + configuration.SetSourceGeneratorFlags(); |
| 91 | + |
| 92 | + configuration.Resolvers = context.Resolvers.GetStuffAsync(); |
| 93 | + configuration.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor<global::System.Collections.Generic.KeyValuePair<int, string>>.Default; |
| 94 | + }, |
| 95 | + (Resolvers: resolvers, ThisType: thisType)); |
| 96 | + |
| 97 | + Configure(descriptor); |
| 98 | + } |
| 99 | + |
| 100 | + static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); |
| 101 | + |
| 102 | + private sealed class __Resolvers |
| 103 | + { |
| 104 | + public HotChocolate.Resolvers.FieldResolverDelegates GetStuffAsync() |
| 105 | + => new global::HotChocolate.Resolvers.FieldResolverDelegates(resolver: GetStuffAsync); |
| 106 | + |
| 107 | + private async global::System.Threading.Tasks.ValueTask<global::System.Object?> GetStuffAsync(global::HotChocolate.Resolvers.IResolverContext context) |
| 108 | + { |
| 109 | + var args0 = context.RequestAborted; |
| 110 | + var result = await global::TestNamespace.Query.GetStuffAsync(args0); |
| 111 | + return result; |
| 112 | + } |
| 113 | + } |
| 114 | + } |
| 115 | +} |
| 116 | + |
| 117 | + |
| 118 | +``` |
| 119 | + |
0 commit comments