public static IDirectiveCollection CreateAndComplete( ITypeCompletionContext context, object source, IEnumerable <DirectiveDefinition> directiveDefinitions) { if (context is null) { throw new ArgumentNullException(nameof(context)); } if (source is null) { throw new ArgumentNullException(nameof(source)); } if (directiveDefinitions is null) { throw new ArgumentNullException(nameof(directiveDefinitions)); } if (!directiveDefinitions.Any()) { return(EmptyDirectiveCollection.Default); } var directives = new DirectiveCollection(source, directiveDefinitions); directives.CompleteCollection(context); return(directives); }
public EnumValue( ITypeCompletionContext completionContext, EnumValueDefinition enumValueDefinition) { if (completionContext == null) { throw new ArgumentNullException(nameof(completionContext)); } if (enumValueDefinition is null) { throw new ArgumentNullException(nameof(enumValueDefinition)); } if (enumValueDefinition.Value is null) { throw new ArgumentException( TypeResources.EnumValue_ValueIsNull, nameof(enumValueDefinition)); } SyntaxNode = enumValueDefinition.SyntaxNode; Name = enumValueDefinition.Name.HasValue ? enumValueDefinition.Name : (NameString)enumValueDefinition.Value.ToString(); Description = enumValueDefinition.Description; DeprecationReason = enumValueDefinition.DeprecationReason; IsDeprecated = !string.IsNullOrEmpty( enumValueDefinition.DeprecationReason); Value = enumValueDefinition.Value; ContextData = enumValueDefinition.ContextData; _directives = new DirectiveCollection(this, enumValueDefinition !.Directives); _directives.CompleteCollection(completionContext); }
protected override void OnCompleteType( ICompletionContext context, TDefinition definition) { base.OnCompleteType(context, definition); var directives = new DirectiveCollection( this, definition.Directives); directives.CompleteCollection(context); Directives = directives; }
internal void CompleteValue(ITypeCompletionContext context) { var directives = new DirectiveCollection( this, _definition.Directives); directives.CompleteCollection(context); Directives = directives; OnCompleteValue(context, _definition); _contextData = new Dictionary <string, object>( _definition.ContextData); _definition = null; }
protected virtual void OnCompleteField( ICompletionContext context, TDefinition definition) { DeclaringType = context.Type; Type = context.GetType <TType>(_definition.Type); ClrType = Type is IHasClrType hasClrType ? hasClrType.ClrType : typeof(object); var directives = new DirectiveCollection( this, _definition.Directives); directives.CompleteCollection(context); Directives = directives; }
internal void CompleteField(ICompletionContext context) { DeclaringType = context.Type; Type = context.GetType <TType>(_definition.Type); ClrType = Type.NamedType() is IHasClrType hasClrType ? hasClrType.ClrType : typeof(object); var directives = new DirectiveCollection( this, _definition.Directives); directives.CompleteCollection(context); Directives = directives; OnCompleteField(context, _definition); _definition = null; }