/// <summary>
        /// Creates a copy of this value resolver injecting it with a specific collection
        /// of variables that can be used during resoltuion. Any previously wrapped variable sets
        /// should be discarded.
        /// </summary>
        /// <param name="variableData">The variable data.</param>
        /// <returns>IInputValueResolver.</returns>
        public override IInputValueResolver WithVariables(IResolvedVariableCollection variableData)
        {
            var resolver = new InputObjectResolver(this);

            resolver.VariableCollection = variableData;
            return(resolver);
        }
Exemple #2
0
        /// <summary>
        /// Creates a copy of this value resolver injecting it with a specific collection
        /// of variables that can be used during resoltuion. Any previously wrapped variable sets
        /// should be discarded.
        /// </summary>
        /// <param name="variableData">The variable data.</param>
        /// <returns>IInputValueResolver.</returns>
        public override IInputValueResolver WithVariables(IResolvedVariableCollection variableData)
        {
            var resolver = new EnumValueResolver(_enumType);

            resolver.VariableCollection = variableData;
            return(resolver);
        }
Exemple #3
0
        /// <summary>
        /// Creates a copy of this value resolver injecting it with a specific collection
        /// of variables that can be used during resoltuion. Any previously wrapped variable sets
        /// should be discarded.
        /// </summary>
        /// <param name="variableData">The variable data.</param>
        /// <returns>IInputValueResolver.</returns>
        public override IInputValueResolver WithVariables(IResolvedVariableCollection variableData)
        {
            var resolver = new ListValueResolver(_listItemType, _itemResolver);

            resolver.VariableCollection = variableData;
            return(resolver);
        }
Exemple #4
0
        /// <summary>
        /// Creates a copy of this value resolver injecting it with a specific collection
        /// of variables that can be used during resoltuion. Any previously wrapped variable sets
        /// should be discarded.
        /// </summary>
        /// <param name="variableData">The variable data.</param>
        /// <returns>IInputValueResolver.</returns>
        public override IInputValueResolver WithVariables(IResolvedVariableCollection variableData)
        {
            var resolver = new ScalarInputResolver(_scalarResolver);

            resolver.VariableCollection = variableData;
            return(resolver);
        }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphFieldExecutionContext" /> class.
 /// </summary>
 /// <param name="parentContext">The parent context.</param>
 /// <param name="fieldRequest">The field request being executed against on this pipeline context.</param>
 /// <param name="variableData">The variable data.</param>
 public GraphFieldExecutionContext(
     IGraphMiddlewareContext parentContext,
     IGraphFieldRequest fieldRequest,
     IResolvedVariableCollection variableData)
     : base(parentContext)
 {
     this.Request             = Validation.ThrowIfNullOrReturn(fieldRequest, nameof(fieldRequest));
     this.VariableData        = variableData;
     this.ResolvedSourceItems = new List <GraphDataItem>();
 }
        /// <summary>
        /// Merges the supplied variable data into a new collection of arguments
        /// capable of fulfilling a request. Any deferred arguments in this instance are resolved
        /// to the data contained in the provided set or null if not found.
        /// </summary>
        /// <param name="variableData">The variable data.</param>
        /// <returns>IInputArgumentCollection.</returns>
        public IExecutionArgumentCollection Merge(IResolvedVariableCollection variableData)
        {
            var collection = new ExecutionArgumentCollection();

            foreach (var arg in _arguments.Values)
            {
                var resolvedValue = arg.Value.Resolve(variableData);
                collection.Add(new ExecutionArgument(arg.Argument, resolvedValue));
            }

            return(collection);
        }
Exemple #7
0
 /// <summary>
 /// Resolves the final value of this input argument using the supplied variable for any replacements necessary.
 /// The variable collection can be null and is ignored if this argument does not require use of it.
 /// </summary>
 /// <param name="variableData">The variable data.</param>
 /// <returns>System.Object.</returns>
 public object Resolve(IResolvedVariableCollection variableData)
 {
     return(_preResolvedValue);
 }
 /// <summary>
 /// Resolves the final value of this input argument using the supplied variable for any replacements necessary.
 /// The variable collection can be null and is ignored if this argument does not require use of it.
 /// </summary>
 /// <param name="variableData">The variable data.</param>
 /// <returns>System.Object.</returns>
 public object Resolve(IResolvedVariableCollection variableData)
 {
     return(_resolver.WithVariables(variableData).Resolve(_coreValue));
 }
 /// <summary>
 /// Creates a copy of this value resolver injecting it with a specific collection
 /// of variables that can be used during resoltuion. Any previously wrapped variable sets
 /// should be discarded.
 /// </summary>
 /// <param name="variableData">The variable data.</param>
 /// <returns>IInputValueResolver.</returns>
 public abstract IInputValueResolver WithVariables(IResolvedVariableCollection variableData);
Exemple #10
0
 /// <summary>
 /// Initializes static members of the <see cref="ResolvedVariableCollection"/> class.
 /// </summary>
 static ResolvedVariableCollection()
 {
     Empty = new ResolvedVariableCollection();
 }