Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,9 @@ private void WriteResolverBindingExtendsWith(
}
}

if (resolver.DescriptorAttributes.Length > 0 || resolver.IsNodeResolver)
if (resolver.DescriptorAttributes.Length > 0
|| resolver.IsNodeResolver
|| resolver.Kind is ResolverKind.ConnectionResolver)
{
Writer.WriteLine();
Writer.WriteIndentedLine("configuration.Member = context.ThisType.GetMethod(");
Expand Down Expand Up @@ -510,7 +512,11 @@ private void WriteResolverBindingExtendsWith(
}
}

if (resolver.DescriptorAttributes.Length > 0)
var needsUseConnection = resolver.Kind is ResolverKind.ConnectionResolver
&& !resolver.DescriptorAttributes.Any(a =>
a.AttributeClass?.ToDisplayString() == WellKnownAttributes.UseConnectionAttribute);

if (resolver.DescriptorAttributes.Length > 0 || needsUseConnection)
{
Writer.WriteLine();
Writer.WriteIndentedLine(
Expand All @@ -526,6 +532,14 @@ private void WriteResolverBindingExtendsWith(
Writer.WriteIndentedLine("configuration.Member,");

var first = true;

if (needsUseConnection)
{
Writer.WriteIndent();
Writer.Write("new global::HotChocolate.Types.UseConnectionAttribute()");
first = false;
}

foreach (var attribute in resolver.DescriptorAttributes)
{
if (!first)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,25 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::HotChocolate.Types.Pagination.ConnectionFlags),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
},
(Resolvers: resolvers, ThisType: thisType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,24 @@ namespace TestNamespace
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
},
(Resolvers: resolvers, ThisType: thisType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,25 @@ namespace TestNamespace.Types.Nodes
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::TestNamespace.Author),
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
},
(Resolvers: resolvers, ThisType: thisType));
Expand Down Expand Up @@ -432,6 +451,24 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
},
(Resolvers: resolvers, ThisType: thisType));
Expand All @@ -454,6 +491,24 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthors2Async",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthors2Async();
},
(Resolvers: resolvers, ThisType: thisType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,25 @@ namespace TestNamespace.Types.Nodes
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::TestNamespace.Author),
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
configuration.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor<global::TestNamespace.Author>.Default;
},
Expand Down Expand Up @@ -439,6 +458,24 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
configuration.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor<global::TestNamespace.Author>.Default;
},
Expand All @@ -462,6 +499,24 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthors2Async",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthors2Async();
configuration.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor<global::TestNamespace.Author>.Default;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,25 @@ namespace TestNamespace.Types.Nodes
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::TestNamespace.Author),
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
configuration.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor<global::TestNamespace.Author>.Default;
},
Expand Down Expand Up @@ -439,6 +458,24 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
configuration.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor<global::TestNamespace.Author>.Default;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,24 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
},
(Resolvers: resolvers, ThisType: thisType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,24 @@ namespace TestNamespace.Types.Root
var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(field.Context, null);
configuration.Features.Set(pagingOptions);

configuration.Member = context.ThisType.GetMethod(
"GetAuthorsAsync",
global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags,
new global::System.Type[]
{
typeof(global::GreenDonut.Data.PagingArguments),
typeof(global::System.Threading.CancellationToken)
})!;

var fieldDescriptor = global::HotChocolate.Types.Descriptors.ObjectFieldDescriptor.From(field.Context, configuration);
HotChocolate.Internal.ConfigurationHelper.ApplyConfiguration(
field.Context,
fieldDescriptor,
configuration.Member,
new global::HotChocolate.Types.UseConnectionAttribute());
configuration.ConfigurationsAreApplied = true;
fieldDescriptor.CreateConfiguration();

configuration.Resolvers = context.Resolvers.GetAuthorsAsync();
},
(Resolvers: resolvers, ThisType: thisType));
Expand Down
Loading
Loading