예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphFieldRequest" /> class.
 /// </summary>
 /// <param name="invocationContext">The invocation context that defines how hte field
 /// should be processed according to the query plan.</param>
 /// <param name="dataSource">The data source containing the the source input data to the field as well as
 /// the graph items referenced by said input data.</param>
 /// <param name="origin">The location in the source query where this field request was generated.</param>
 /// <param name="items">A collection of meta data items to carry with this request.</param>
 public GraphFieldRequest(
     IGraphFieldInvocationContext invocationContext,
     GraphFieldDataSource dataSource,
     SourceOrigin origin,
     MetaDataCollection items = null)
 {
     this.Id = Guid.NewGuid().ToString("N");
     this.InvocationContext = Validation.ThrowIfNullOrReturn(invocationContext, nameof(invocationContext));
     this.Origin            = Validation.ThrowIfNullOrReturn(origin, nameof(origin));
     this.Items             = items ?? new MetaDataCollection();
     this.DataSource        = dataSource;
 }
예제 #2
0
        /// <summary>
        /// Merges the provided collection into this one. Any existing keys in this instance are updated with their new values
        /// and non-existant keys are added to this instance.
        /// </summary>
        /// <param name="otherCollection">The other collection.</param>
        public void Merge(MetaDataCollection otherCollection)
        {
            if (otherCollection == null)
            {
                return;
            }

            foreach (var kvp in otherCollection)
            {
                this[kvp.Key] = kvp.Value;
            }
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphDirectiveRequest" /> class.
 /// </summary>
 /// <param name="targetDirective">The target directive.</param>
 /// <param name="location">The location.</param>
 /// <param name="origin">The origin.</param>
 /// <param name="requestMetaData">The request meta data.</param>
 public GraphDirectiveRequest(
     IDirectiveGraphType targetDirective,
     DirectiveLocation location,
     SourceOrigin origin,
     MetaDataCollection requestMetaData = null)
 {
     this.Id                = Guid.NewGuid().ToString("N");
     this.Directive         = Validation.ThrowIfNullOrReturn(targetDirective, nameof(targetDirective));
     this.LifeCycle         = DirectiveLifeCycle.BeforeResolution;
     this.DirectiveLocation = location;
     this.Origin            = origin ?? SourceOrigin.None;
     this.Items             = requestMetaData ?? new MetaDataCollection();
 }