@@ -308,15 +308,9 @@ In some cases, it may be necessary to use `Field` instead of `AddQueryField`/`Ad
308308<!-- snippet: ManuallyApplyWhere -->
309309<a id =' snippet-manuallyapplywhere ' ></a >
310310``` cs
311- Field <ListGraphType <EmployeeSummaryGraphType >>(
312- name : " employeeSummary" ,
313- arguments : new (
314- new QueryArgument <ListGraphType <WhereExpressionGraph >>
315- {
316- Name = " where"
317- }
318- ),
319- resolve : context =>
311+ Field <ListGraphType <EmployeeSummaryGraphType >>(" employeeSummary" )
312+ .Argument <ListGraphType <WhereExpressionGraph >>(" where" )
313+ .Resolve (context =>
320314 {
321315 var dbContext = ResolveDbContext (context );
322316 IQueryable < Employee > query = dbContext .Employees ;
@@ -330,7 +324,10 @@ Field<ListGraphType<EmployeeSummaryGraphType>>(
330324 }
331325
332326 return from q in query
333- group q by new {q .CompanyId }
327+ group q by new
328+ {
329+ q .CompanyId
330+ }
334331 into g
335332 select new EmployeeSummary
336333 {
@@ -339,7 +336,7 @@ Field<ListGraphType<EmployeeSummaryGraphType>>(
339336 };
340337 });
341338```
342- <sup ><a href =' /src/SampleWeb/Query.cs#L53-L86 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-manuallyapplywhere ' title =' Start of snippet ' >anchor</a ></sup >
339+ <sup ><a href =' /src/SampleWeb/Query.cs#L53-L83 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-manuallyapplywhere ' title =' Start of snippet ' >anchor</a ></sup >
343340<!-- endSnippet -->
344341
345342
@@ -355,17 +352,16 @@ public class Query :
355352{
356353 public Query (IEfGraphQLService <MyDbContext > graphQlService ) :
357354 base (graphQlService ) =>
358- Field <ListGraphType <CompanyGraph >>(
359- name : " oldCompanies" ,
360- resolve : context =>
355+ Field <ListGraphType <CompanyGraph >>(" oldCompanies" )
356+ .Resolve (context =>
361357 {
362358 // uses the base QueryGraphType to resolve the db context
363359 var dbContext = ResolveDbContext (context );
364360 return dbContext .Companies .Where (x => x .Age > 10 );
365361 });
366362}
367363```
368- <sup ><a href =' /src/Snippets/ResolveDbContextQuery.cs#L7-L24 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-queryresolvedbcontext ' title =' Start of snippet ' >anchor</a ></sup >
364+ <sup ><a href =' /src/Snippets/ResolveDbContextQuery.cs#L7-L23 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-queryresolvedbcontext ' title =' Start of snippet ' >anchor</a ></sup >
369365<!-- endSnippet -->
370366
371367
0 commit comments