/// <summary> /// Initializes a new instance of the <see cref="VirtualGraphFieldArgument" /> class. /// </summary> /// <param name="name">The name of this field in the object graph.</param> /// <param name="internalName">The name of this field as it exists in the .NET code.</param> /// <param name="typeExpression">The graph type expression representing this field.</param> /// <param name="concreteType">The concrete graph type in the server code that this argument is mapped to.</param> /// <param name="argModifiers">The argument modifiers.</param> /// <param name="defaultValue">The default value.</param> public VirtualGraphFieldArgument( string name, string internalName, GraphTypeExpression typeExpression, Type concreteType, GraphArgumentModifiers argModifiers = GraphArgumentModifiers.None, object defaultValue = null) { this.ObjectType = Validation.ThrowIfNullOrReturn(concreteType, nameof(concreteType)); this.InternalName = Validation.ThrowIfNullWhiteSpaceOrReturn(internalName, nameof(internalName)); this.Name = Validation.ThrowIfNullWhiteSpaceOrReturn(name, nameof(name)); this.ParameterName = this.Name; this.TypeExpression = Validation.ThrowIfNullOrReturn(typeExpression, nameof(typeExpression)); this.ArgumentModifiers = argModifiers; this.DefaultValue = defaultValue; }
/// <summary> /// Initializes a new instance of the <see cref="GraphFieldArgument" /> class. /// </summary> /// <param name="argumentName">Name of the argument.</param> /// <param name="typeExpression">The type expression.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="parameterName">Name of the parameter as it is declared in the source code.</param> /// <param name="internalname">The fully qualified internal name identifiying this argument.</param> /// <param name="objectType">The concrete type of the object representing this argument.</param> /// <param name="defaultValue">The default value.</param> public GraphFieldArgument( string argumentName, GraphTypeExpression typeExpression, GraphArgumentModifiers modifiers, string parameterName, string internalname, Type objectType, object defaultValue = null) { this.Name = Validation.ThrowIfNullWhiteSpaceOrReturn(argumentName, nameof(argumentName)); this.InternalName = Validation.ThrowIfNullWhiteSpaceOrReturn(internalname, nameof(internalname)); this.ParameterName = Validation.ThrowIfNullWhiteSpaceOrReturn(parameterName, nameof(parameterName)); this.TypeExpression = Validation.ThrowIfNullOrReturn(typeExpression, nameof(typeExpression)); this.ObjectType = Validation.ThrowIfNullOrReturn(objectType, nameof(objectType)); this.ArgumentModifiers = modifiers; this.DefaultValue = defaultValue; }
/// <summary> /// Determines whether the modifers indicate the argument is to contain the source data value supplied to the resolver for the field. /// </summary> /// <param name="modifiers">The modifiers.</param> /// <returns><c>true</c> if [is source parameter] [the specified modifiers]; otherwise, <c>false</c>.</returns> public static bool IsSourceParameter(this GraphArgumentModifiers modifiers) { return(modifiers.HasFlag(GraphArgumentModifiers.ParentFieldResult)); }