Skip to content

Instantly share code, notes, and snippets.

@tuannguyenssu tuannguyenssu/OrderType.cs Secret
Created Aug 15, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.