/// <summary> /// Initializes a new instance of the <see cref="BaseObjectGraphType" /> class. /// </summary> /// <param name="name">The name of the graph type as it is displayed in the __type information.</param> /// <param name="graphFields">The initial set of graph fields to add to this instance.</param> protected BaseObjectGraphType(string name, IEnumerable <IGraphField> graphFields = null) { this.Name = Validation.ThrowIfNullWhiteSpaceOrReturn(name, nameof(name)); _graphFields = new GraphFieldCollection(); this.InterfaceNames = new HashSet <string>(); this.Publish = true; if (graphFields != null) { foreach (var field in graphFields) { _graphFields.AddField(field); } } }
/// <summary> /// Initializes a new instance of the <see cref="InterfaceGraphType" /> class. /// </summary> /// <param name="name">The name.</param> /// <param name="concreteType">The concrete type representing this interface.</param> /// <param name="fields">The fields that define the interface.</param> public InterfaceGraphType(string name, Type concreteType, IEnumerable <IGraphField> fields) { this.Name = Validation.ThrowIfNullOrReturn(name, nameof(name)); _fieldSet = new GraphFieldCollection(); _interfaceType = Validation.ThrowIfNullOrReturn(concreteType, nameof(concreteType)); this.Publish = true; if (fields != null) { foreach (var field in fields) { this.Extend(field); } } this.Extend(new Introspection_TypeNameMetaField(name)); }