-
-
Save tuannguyenssu/a44ac9ab92dd5b06db6638d4cac14ab5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GraphQL.Types; | |
using GraphQLTest.Models; | |
using GraphQLTest.Services; | |
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace GraphQLTest.GraphQL | |
{ | |
public class OrderType : ObjectGraphType<Order> | |
{ | |
public OrderType(ICustomerService customers) | |
{ | |
Field(o => o.Id); | |
Field(o => o.Name); | |
Field<CustomerType>("customer", | |
resolve: context => customers.GetCustomerByIdAsync(context.Source.CustomerId)); | |
Field<OrderStatusesEnum>("status", | |
resolve: context => context.Source.Status); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment