Beispiel #1
0
        private void Initialize(Action <IObjectTypeDescriptor> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            ObjectTypeDescriptor descriptor = CreateDescriptor();

            configure(descriptor);

            ObjectTypeDescription description = descriptor.CreateDescription();

            InitializeFields(description);

            _isOfType   = description.IsOfType;
            _interfaces = description.Interfaces;

            SyntaxNode = description.SyntaxNode;

            Initialize(description.Name, description.Description,
                       new DirectiveCollection(
                           this,
                           DirectiveLocation.Object,
                           description.Directives));
        }
Beispiel #2
0
        private void InitializeFields(ObjectTypeDescription description)
        {
            var fieldBindings = new List <FieldBinding>();
            var fields        = new List <ObjectField> {
                new __TypeNameField()
            };

            CreateFieldsAndBindings(description.Fields, fieldBindings, fields);

            if (description.ClrType != null)
            {
                _typeBinding = new ObjectTypeBinding(
                    description.Name, description.ClrType,
                    this, fieldBindings);
            }

            Fields = new FieldCollection <ObjectField>(fields);
        }