/// <summary> /// Initializes a new instance of the <see cref="GraphQueryExecutionContext" /> class. /// </summary> /// <param name="request">The request to be processed through the query pipeline.</param> /// <param name="serviceProvider">The service provider passed on the HttpContext.</param> /// <param name="user">The user authenticated by the Asp.net runtime.</param> /// <param name="metrics">The metrics package to profile this request, if any.</param> /// <param name="logger">The logger instance to record events related to this context.</param> /// <param name="items">A key/value pair collection for random access data.</param> public GraphQueryExecutionContext( IGraphOperationRequest request, IServiceProvider serviceProvider, ClaimsPrincipal user = null, IGraphQueryExecutionMetrics metrics = null, IGraphEventLogger logger = null, MetaDataCollection items = null) : base(serviceProvider, user, metrics, logger, items) { this.Request = Validation.ThrowIfNullOrReturn(request, nameof(request)); this.FieldResults = new List <GraphDataItem>(); }
/// <summary> /// Initializes a new instance of the <see cref="SubcriptionExecutionContext" /> class. /// </summary> /// <param name="client">The client.</param> /// <param name="request">The request to be processed through the query pipeline.</param> /// <param name="subscriptionId">The unique id to assign to the created subscription, when one is made.</param> /// <param name="metrics">The metrics package to profile this request, if any.</param> /// <param name="logger">The logger instance to record events related to this context.</param> /// <param name="items">A key/value pair collection for random access data.</param> public SubcriptionExecutionContext( ISubscriptionClientProxy client, IGraphOperationRequest request, string subscriptionId, IGraphQueryExecutionMetrics metrics = null, IGraphEventLogger logger = null, MetaDataCollection items = null) : base(request, client?.ServiceProvider, client?.User, metrics, logger, items) { this.Client = Validation.ThrowIfNullOrReturn(client, nameof(client)); this.SubscriptionId = Validation.ThrowIfNullWhiteSpaceOrReturn(subscriptionId, nameof(subscriptionId)); }
/// <summary> /// Initializes a new instance of the <see cref="GraphOperationResult" /> class. /// </summary> /// <param name="originalRequest">The original request.</param> /// <param name="messages">The message collection containing any messages that may /// have been generated during execution.</param> /// <param name="dataItem">The top level field set resolved during the operation.</param> /// <param name="metrics">The metrics package that was filled during the operation execution.</param> public GraphOperationResult( IGraphOperationRequest originalRequest, IEnumerable <IGraphMessage> messages = null, IResponseFieldSet dataItem = null, IGraphQueryExecutionMetrics metrics = null) { this.Request = originalRequest; this.Data = dataItem; this.Messages = new GraphMessageCollection(); if (messages != null) { this.Messages.AddRange(messages); } this.Metrics = metrics; }
/// <inheritdoc /> public Task <IGraphOperationResult> ExecuteRequest( IServiceProvider serviceProvider, ClaimsPrincipal user, IGraphOperationRequest request, bool enableMetrics = false, CancellationToken cancelToken = default) { Validation.ThrowIfNull(serviceProvider, nameof(serviceProvider)); Validation.ThrowIfNull(user, nameof(user)); Validation.ThrowIfNull(request, nameof(request)); return(this.ExecuteRequest( serviceProvider, user, request, enableMetrics ? this.CreateMetricsPackage() : null, cancelToken)); }
/// <inheritdoc /> public Task <IGraphOperationResult> ExecuteRequest( IServiceProvider serviceProvider, ClaimsPrincipal user, IGraphOperationRequest request, IGraphQueryExecutionMetrics metricsPackage = null, CancellationToken cancelToken = default) { Validation.ThrowIfNull(serviceProvider, nameof(serviceProvider)); Validation.ThrowIfNull(user, nameof(user)); Validation.ThrowIfNull(request, nameof(request)); var context = new GraphQueryExecutionContext( request, serviceProvider, user, metricsPackage, _logger); return(this.ExecuteRequest(context, cancelToken)); }