Пример #1
0
        public bool TryGetOperationHandler(
            ITypeCompletionContext context,
            EnumTypeDefinition typeDefinition,
            SortEnumValueDefinition fieldDefinition,
            [NotNullWhen(true)] out ISortOperationHandler?handler)
        {
            foreach (ISortOperationHandler sortFieldHandler in _provider.OperationHandlers)
            {
                if (sortFieldHandler.CanHandle(context, typeDefinition, fieldDefinition))
                {
                    handler = sortFieldHandler;
                    return(true);
                }
            }

            handler = null;
            return(false);
        }
Пример #2
0
        public SortEnumValue(
            ITypeCompletionContext completionContext,
            SortEnumValueDefinition 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(
                          DataResources.SortEnumValue_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;
            Handler     = enumValueDefinition.Handler;
            Operation   = enumValueDefinition.Operation;

            _directives = new DirectiveCollection(this, enumValueDefinition !.GetDirectives());
            _directives.CompleteCollection(completionContext);
        }
 /// <inheritdoc />
 public abstract bool CanHandle(
     ITypeCompletionContext context,
     EnumTypeDefinition typeDefinition,
     SortEnumValueDefinition valueDefinition);
 protected SortEnumValueDescriptor(
     IDescriptorContext context,
     SortEnumValueDefinition definition)
     : base(context, definition)
 {
 }
Пример #5
0
 /// <inheritdoc />
 public abstract bool CanHandle(
     ITypeDiscoveryContext context,
     EnumTypeDefinition typeDefinition,
     SortEnumValueDefinition valueDefinition);
Пример #6
0
 public override bool CanHandle(
     ITypeDiscoveryContext context,
     EnumTypeDefinition typeDefinition,
     SortEnumValueDefinition valueDefinition) => true;