diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 19b8e97ef..6fe32e895 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;NU5104;CS1573;CS9107;NU1608 - 28.0.0 + 28.1.0 preview 1.0.0 EntityFrameworkCore, EntityFramework, GraphQL diff --git a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_First.cs b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_First.cs index 5bcdcf4bf..4bbc5322d 100644 --- a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_First.cs +++ b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_First.cs @@ -19,6 +19,22 @@ public FieldBuilder AddFirstField( return new FieldBuilderEx(field); } + public FieldBuilder AddFirstField( + IObjectGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class + { + var field = BuildFirstField(name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + graph.AddField(field); + return new FieldBuilderEx(field); + } + public FieldBuilder AddFirstField( IComplexGraphType graph, string name, @@ -35,6 +51,22 @@ public FieldBuilder AddFirstField( return new FieldBuilderEx(field); } + public FieldBuilder AddFirstField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class + { + var field = BuildFirstField(name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + graph.AddField(field); + return new FieldBuilderEx(field); + } + public FieldBuilder AddFirstField( IComplexGraphType graph, string name, @@ -51,6 +83,22 @@ public FieldBuilder AddFirstField( return new FieldBuilderEx(field); } + public FieldBuilder AddFirstField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class + { + var field = BuildFirstField(name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + graph.AddField(field); + return new FieldBuilderEx(field); + } + FieldType BuildFirstField( string name, Func, IQueryable> resolve, @@ -60,6 +108,28 @@ FieldType BuildFirstField( bool omitQueryArguments, bool idOnly) where TReturn : class + => BuildFirstField( + name, + _ => + { + var queryable = resolve(_); + return Task.FromResult(queryable); + }, + mutate, + graphType, + nullable, + omitQueryArguments, + idOnly); + + FieldType BuildFirstField( + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate, + Type? graphType, + bool nullable, + bool omitQueryArguments, + bool idOnly) + where TReturn : class { Guard.AgainstWhiteSpace(nameof(name), name); @@ -71,79 +141,78 @@ FieldType BuildFirstField( { Name = name, Type = graphType, - Resolver = new FuncFieldResolver( - async context => - { - var efFieldContext = BuildContext(context); + Resolver = new FuncFieldResolver(async context => + { + var efFieldContext = BuildContext(context); - var query = resolve(efFieldContext); - if (disableTracking) - { - query = query.AsNoTracking(); - } + var query = await resolve(efFieldContext); + if (disableTracking) + { + query = query.AsNoTracking(); + } - query = includeAppender.AddIncludes(query, context); - query = query.ApplyGraphQlArguments(context, names, false, omitQueryArguments); + query = includeAppender.AddIncludes(query, context); + query = query.ApplyGraphQlArguments(context, names, false, omitQueryArguments); - QueryLogger.Write(query); + QueryLogger.Write(query); - TReturn? first; - try - { - if (disableAsync) - { - first = query.FirstOrDefault(); - } - else - { - first = await query.FirstOrDefaultAsync(context.CancellationToken); - } - } - catch (TaskCanceledException) - { - throw; - } - catch (OperationCanceledException) + TReturn? first; + try + { + if (disableAsync) { - throw; + first = query.FirstOrDefault(); } - catch (Exception exception) + else { - throw new( - $""" - Failed to execute query for field `{name}` - GraphType: {graphType.FullName} - TSource: {typeof(TSource).FullName} - TReturn: {typeof(TReturn).FullName} - DisableAsync: {disableAsync} - OmitQueryArguments: {omitQueryArguments} - Nullable: {nullable} - KeyNames: {JoinKeys(names)} - Query: {query.ToQueryString()} - """, - exception); + first = await query.FirstOrDefaultAsync(context.CancellationToken); } - - if (first is not null) + } + catch (TaskCanceledException) + { + throw; + } + catch (OperationCanceledException) + { + throw; + } + catch (Exception exception) + { + throw new( + $""" + Failed to execute query for field `{name}` + GraphType: {graphType.FullName} + TSource: {typeof(TSource).FullName} + TReturn: {typeof(TReturn).FullName} + DisableAsync: {disableAsync} + OmitQueryArguments: {omitQueryArguments} + Nullable: {nullable} + KeyNames: {JoinKeys(names)} + Query: {query.ToQueryString()} + """, + exception); + } + + if (first is not null) + { + if (await efFieldContext.Filters.ShouldInclude(context.UserContext, context.User, first)) { - if (await efFieldContext.Filters.ShouldInclude(context.UserContext, context.User, first)) + if (mutate is not null) { - if (mutate is not null) - { - await mutate.Invoke(efFieldContext, first); - } - - return first; + await mutate.Invoke(efFieldContext, first); } - } - if (nullable) - { - return null; + return first; } + } + + if (nullable) + { + return null; + } - throw new FirstEntityNotFoundException(); - }) + throw new FirstEntityNotFoundException(); + }) }; if (!omitQueryArguments) diff --git a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Queryable.cs b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Queryable.cs index a091f9268..7e9f1cb07 100644 --- a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Queryable.cs +++ b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Queryable.cs @@ -16,6 +16,19 @@ public FieldBuilder AddQueryField( return new FieldBuilderEx(field); } + public FieldBuilder AddQueryField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? graphType = null, + bool omitQueryArguments = false) + where TReturn : class + { + var field = BuildQueryField(graphType, name, resolve, omitQueryArguments); + graph.AddField(field); + return new FieldBuilderEx(field); + } + public FieldBuilder AddQueryField( IComplexGraphType graph, string name, @@ -29,11 +42,36 @@ public FieldBuilder AddQueryField( return new FieldBuilderEx(field); } + public FieldBuilder AddQueryField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? itemGraphType = null, + bool omitQueryArguments = false) + where TReturn : class + { + var field = BuildQueryField(itemGraphType, name, resolve, omitQueryArguments); + graph.AddField(field); + return new FieldBuilderEx(field); + } + FieldType BuildQueryField( Type? itemGraphType, string name, Func, IQueryable>? resolve, bool omitQueryArguments) + where TReturn : class => + BuildQueryField( + itemGraphType, + name, + resolve == null ? null : context => Task.FromResult(resolve(context)), + omitQueryArguments); + + FieldType BuildQueryField( + Type? itemGraphType, + string name, + Func, Task>>? resolve, + bool omitQueryArguments) where TReturn : class { Guard.AgainstWhiteSpace(nameof(name), name); @@ -53,7 +91,7 @@ FieldType BuildQueryField( async context => { var fieldContext = BuildContext(context); - var query = resolve(fieldContext); + var query = await resolve(fieldContext); if (disableTracking) { query = query.AsNoTracking(); diff --git a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_QueryableConnection.cs b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_QueryableConnection.cs index e01b08154..f5299e296 100644 --- a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_QueryableConnection.cs +++ b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_QueryableConnection.cs @@ -12,6 +12,20 @@ public ConnectionBuilder AddQueryConnectionField( Func, IOrderedQueryable>? resolve = null, Type? itemGraphType = null, bool omitQueryArguments = false) + where TReturn : class => + AddQueryConnectionField( + graph, + name, + resolve == null ? null : context => Task.FromResult(resolve(context)), + itemGraphType, + omitQueryArguments); + + public ConnectionBuilder AddQueryConnectionField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? itemGraphType = null, + bool omitQueryArguments = false) where TReturn : class { itemGraphType ??= GraphTypeFinder.FindGraphType(); @@ -54,6 +68,20 @@ public ConnectionBuilder AddQueryConnectionField( Func, IOrderedQueryable>? resolve = null, Type? itemGraphType = null, bool omitQueryArguments = false) + where TReturn : class => + AddQueryConnectionField( + graph, + name, + resolve == null ? null : context => Task.FromResult(resolve(context)), + itemGraphType, + omitQueryArguments); + + public ConnectionBuilder AddQueryConnectionField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? itemGraphType = null, + bool omitQueryArguments = false) where TReturn : class { itemGraphType ??= GraphTypeFinder.FindGraphType(); @@ -95,7 +123,7 @@ public ConnectionBuilder AddQueryConnectionField( ConnectionBuilder AddQueryableConnection( IComplexGraphType graph, string name, - Func, IQueryable>? resolve, + Func, Task>>? resolve, bool omitQueryArguments) where TGraph : IGraphType where TReturn : class @@ -109,7 +137,7 @@ ConnectionBuilder AddQueryableConnection( async context => { var efFieldContext = BuildContext(context); - var query = resolve(efFieldContext); + IQueryable query = await resolve(efFieldContext); if (disableTracking) { query = query.AsNoTracking(); diff --git a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Single.cs b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Single.cs index 84d1abbfe..4e6c9a266 100644 --- a/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Single.cs +++ b/src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Single.cs @@ -19,6 +19,22 @@ public FieldBuilder AddSingleField( return new FieldBuilderEx(field); } + public FieldBuilder AddSingleField( + IObjectGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class + { + var field = BuildSingleField(name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + graph.AddField(field); + return new FieldBuilderEx(field); + } + public FieldBuilder AddSingleField( IComplexGraphType graph, string name, @@ -35,6 +51,22 @@ public FieldBuilder AddSingleField( return new FieldBuilderEx(field); } + public FieldBuilder AddSingleField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class + { + var field = BuildSingleField(name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + graph.AddField(field); + return new FieldBuilderEx(field); + } + public FieldBuilder AddSingleField( IComplexGraphType graph, string name, @@ -51,6 +83,22 @@ public FieldBuilder AddSingleField( return new FieldBuilderEx(field); } + public FieldBuilder AddSingleField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class + { + var field = BuildSingleField(name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + graph.AddField(field); + return new FieldBuilderEx(field); + } + FieldType BuildSingleField( string name, Func, IQueryable> resolve, @@ -60,10 +108,31 @@ FieldType BuildSingleField( bool omitQueryArguments, bool idOnly) where TReturn : class + => BuildSingleField( + name, + _ => + { + var queryable = resolve(_); + return Task.FromResult(queryable); + }, + mutate, + graphType, + nullable, + omitQueryArguments, + idOnly); + + FieldType BuildSingleField( + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate, + Type? graphType, + bool nullable, + bool omitQueryArguments, + bool idOnly) + where TReturn : class { Guard.AgainstWhiteSpace(nameof(name), name); - graphType ??= GraphTypeFinder.FindGraphType(nullable); var names = GetKeyNames(); @@ -77,7 +146,7 @@ FieldType BuildSingleField( { var efFieldContext = BuildContext(context); - var query = resolve(efFieldContext); + var query = await resolve(efFieldContext); if (disableTracking) { query = query.AsNoTracking(); diff --git a/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs b/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs index 7753617af..46dfb9f9e 100644 --- a/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs +++ b/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs @@ -33,14 +33,14 @@ public ConnectionBuilder AddQueryConnectionField( string name, Type? graphType = null) where TReturn : class => - GraphQlService.AddQueryConnectionField(this, name, null, graphType); + GraphQlService.AddQueryConnectionField(this, name, (Func, Task>>?)null, graphType); public FieldBuilder AddQueryField( string name, Type? graphType = null, bool omitQueryArguments = false) where TReturn : class => - GraphQlService.AddQueryField(this, name, null, graphType, omitQueryArguments); + GraphQlService.AddQueryField(this, name, (Func, Task>>?)null, graphType, omitQueryArguments); public TDbContext ResolveDbContext(IResolveFieldContext context) => GraphQlService.ResolveDbContext(context); diff --git a/src/GraphQL.EntityFramework/GraphApi/EfObjectGraphType.cs b/src/GraphQL.EntityFramework/GraphApi/EfObjectGraphType.cs index 260bf221f..f5b9e9d95 100644 --- a/src/GraphQL.EntityFramework/GraphApi/EfObjectGraphType.cs +++ b/src/GraphQL.EntityFramework/GraphApi/EfObjectGraphType.cs @@ -58,6 +58,14 @@ public FieldBuilder AddQueryField( where TReturn : class => GraphQlService.AddQueryField(this, name, resolve, graphType, omitQueryArguments); + public FieldBuilder AddQueryField( + string name, + Func, Task>> resolve, + Type? graphType = null, + bool omitQueryArguments = false) + where TReturn : class => + GraphQlService.AddQueryField(this, name, resolve, graphType, omitQueryArguments); + public TDbContext ResolveDbContext(IResolveFieldContext context) => GraphQlService.ResolveDbContext(context); @@ -75,6 +83,17 @@ public FieldBuilder AddSingleField( where TReturn : class => GraphQlService.AddSingleField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + public FieldBuilder AddSingleField( + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class => + GraphQlService.AddSingleField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + public FieldBuilder AddFirstField( string name, Func, IQueryable> resolve, @@ -85,4 +104,15 @@ public FieldBuilder AddFirstField( bool idOnly = false) where TReturn : class => GraphQlService.AddFirstField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + + public FieldBuilder AddFirstField( + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class => + GraphQlService.AddFirstField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); } \ No newline at end of file diff --git a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_First.cs b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_First.cs index 153b39514..0fd83bbb8 100644 --- a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_First.cs +++ b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_First.cs @@ -13,6 +13,17 @@ FieldBuilder AddFirstField( bool idOnly = false) where TReturn : class; + FieldBuilder AddFirstField( + IObjectGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class; + FieldBuilder AddFirstField( IComplexGraphType graph, string name, @@ -24,6 +35,17 @@ FieldBuilder AddFirstField( bool idOnly = false) where TReturn : class; + FieldBuilder AddFirstField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class; + FieldBuilder AddFirstField( IComplexGraphType graph, string name, @@ -34,4 +56,15 @@ FieldBuilder AddFirstField( bool omitQueryArguments = false, bool idOnly = false) where TReturn : class; + + FieldBuilder AddFirstField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class; } \ No newline at end of file diff --git a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Queryable.cs b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Queryable.cs index 5937e492b..eba394be2 100644 --- a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Queryable.cs +++ b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Queryable.cs @@ -9,6 +9,13 @@ FieldBuilder AddQueryField( Type? itemGraphType = null, bool omitQueryArguments = false) where TReturn : class; + FieldBuilder AddQueryField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? itemGraphType = null, + bool omitQueryArguments = false) + where TReturn : class; FieldBuilder AddQueryField( IComplexGraphType graph, @@ -17,4 +24,12 @@ FieldBuilder AddQueryField( Type? itemGraphType = null, bool omitQueryArguments = false) where TReturn : class; + + FieldBuilder AddQueryField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? itemGraphType = null, + bool omitQueryArguments = false) + where TReturn : class; } \ No newline at end of file diff --git a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_QueryableConnection.cs b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_QueryableConnection.cs index e44919b87..1deb6637d 100644 --- a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_QueryableConnection.cs +++ b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_QueryableConnection.cs @@ -10,6 +10,14 @@ ConnectionBuilder AddQueryConnectionField( bool omitQueryArguments = false) where TReturn : class; + ConnectionBuilder AddQueryConnectionField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? itemGraphType = null, + bool omitQueryArguments = false) + where TReturn : class; + ConnectionBuilder AddQueryConnectionField( IComplexGraphType graph, string name, @@ -17,4 +25,12 @@ ConnectionBuilder AddQueryConnectionField( Type? itemGraphType = null, bool omitQueryArguments = false) where TReturn : class; + + ConnectionBuilder AddQueryConnectionField( + IComplexGraphType graph, + string name, + Func, Task>>? resolve = null, + Type? itemGraphType = null, + bool omitQueryArguments = false) + where TReturn : class; } \ No newline at end of file diff --git a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Single.cs b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Single.cs index 70706a796..5254540f7 100644 --- a/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Single.cs +++ b/src/GraphQL.EntityFramework/GraphApi/IEfGraphQLService_Single.cs @@ -13,6 +13,17 @@ FieldBuilder AddSingleField( bool idOnly = false) where TReturn : class; + FieldBuilder AddSingleField( + IObjectGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class; + FieldBuilder AddSingleField( IComplexGraphType graph, string name, @@ -24,6 +35,17 @@ FieldBuilder AddSingleField( bool idOnly = false) where TReturn : class; + FieldBuilder AddSingleField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class; + FieldBuilder AddSingleField( IComplexGraphType graph, string name, @@ -34,4 +56,15 @@ FieldBuilder AddSingleField( bool omitQueryArguments = false, bool idOnly = false) where TReturn : class; + + FieldBuilder AddSingleField( + IComplexGraphType graph, + string name, + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class; } \ No newline at end of file diff --git a/src/GraphQL.EntityFramework/GraphApi/QueryGraphType.cs b/src/GraphQL.EntityFramework/GraphApi/QueryGraphType.cs index 64677a6a4..c7aacaf0d 100644 --- a/src/GraphQL.EntityFramework/GraphApi/QueryGraphType.cs +++ b/src/GraphQL.EntityFramework/GraphApi/QueryGraphType.cs @@ -27,6 +27,14 @@ public FieldBuilder AddQueryField( where TReturn : class => GraphQlService.AddQueryField(this, name, resolve, graphType, omitQueryArguments); + public FieldBuilder AddQueryField( + string name, + Func, Task>> resolve, + Type? graphType = null, + bool omitQueryArguments = false) + where TReturn : class => + GraphQlService.AddQueryField(this, name, resolve, graphType, omitQueryArguments); + public FieldBuilder AddSingleField( Func, IQueryable> resolve, Func, TReturn, Task>? mutate = null, @@ -38,6 +46,17 @@ public FieldBuilder AddSingleField( where TReturn : class => GraphQlService.AddSingleField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + public FieldBuilder AddSingleField( + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + string name = nameof(TReturn), + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class => + GraphQlService.AddSingleField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + public FieldBuilder AddFirstField( Func, IQueryable> resolve, Func, TReturn, Task>? mutate = null, @@ -49,6 +68,17 @@ public FieldBuilder AddFirstField( where TReturn : class => GraphQlService.AddFirstField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + public FieldBuilder AddFirstField( + Func, Task>> resolve, + Func, TReturn, Task>? mutate = null, + Type? graphType = null, + string name = nameof(TReturn), + bool nullable = false, + bool omitQueryArguments = false, + bool idOnly = false) + where TReturn : class => + GraphQlService.AddFirstField(this, name, resolve, mutate, graphType, nullable, omitQueryArguments, idOnly); + public IQueryable AddIncludes(IQueryable query, IResolveFieldContext context) where TItem : class => GraphQlService.AddIncludes(query, context);