Skip to content

Instantly share code, notes, and snippets.

@tuannguyenssu
Created August 15, 2019 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuannguyenssu/a44ac9ab92dd5b06db6638d4cac14ab5 to your computer and use it in GitHub Desktop.
Save tuannguyenssu/a44ac9ab92dd5b06db6638d4cac14ab5 to your computer and use it in GitHub Desktop.
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