TSchemaDocument.Bind Method
Binds an existing object type to a class.
Remarks
The binding process tries to automatically set the resolver of all object type fields. For each field in the object type, it checks if the class has a member (method, property or field - in this order) with the same name as the object type field. In the case of a method, it also checks if the field input arguments have the same name as the method parameter names. If the class member is found, then a resolver is set for the field. At runtime, during the query execution, when resolving the field, the resolver will invoke the respective method passing the proper arguments (or read the property/field value) and used the returned value as the field resolution value. If the specified object type is not found, an exception is raised. If a resolver cannot be found for each and every field of the specified object type, an exception is raised.s
Syntax
Unit: GraphQL.Schema
procedure TSchemaDocument.Bind(const ObjectTypeName: string; BoundClass: TClass);
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | ObjectTypeName | string | The name of the object type to be bound. |
BoundClass | TClass | The class to be bound to the object type. |