示例#1
0
            public ValueTask <IReadOnlyCollection <ITypeSystemMember> > CreateTypesAsync(
                IDescriptorContext context,
                CancellationToken cancellationToken)
            {
                var list = new List <ITypeSystemMember>();

                var typeDefinition = new ObjectTypeDefinition("Query");

                typeDefinition.Fields.Add(new(
                                              "hello",
                                              type: TypeReference.Parse("String!"),
                                              pureResolver: _ => "world"));
                list.Add(ObjectType.CreateUnsafe(typeDefinition));

                var typeExtensionDefinition = new ObjectTypeDefinition("Person");

                typeExtensionDefinition.Fields.Add(new(
                                                       "dynamic",
                                                       type: TypeReference.Parse("String!"),
                                                       pureResolver: _ => "value"));
                list.Add(ObjectTypeExtension.CreateUnsafe(typeExtensionDefinition));

                return(new(list));
            }