internal void InvokeProcessingRequest(object sender, DataServiceProcessingPipelineEventArgs e)
 {
     if (this.ProcessingRequest != null)
     {
         this.ProcessingRequest(sender, e);
     }
 }
 internal void InvokeProcessingRequest(object sender, DataServiceProcessingPipelineEventArgs e)
 {
     if (this.ProcessingRequest != null)
     {
         this.ProcessingRequest(sender, e);
     }
 }
Example #3
0
		public static void ProcessedRequestHandler(object source, DataServiceProcessingPipelineEventArgs args)
		{
			TraceHelper.Current.DebugMessage("QuotaSystem.ProcessedRequestHandler entered");
			if (args != null)
			{
				args.OperationContext.Trace();
			}
			UserContext userContext = new UserContext(CurrentRequestHelper.Identity, CurrentRequestHelper.Certificate);
			if (DataServiceController.Current.IsRequestProcessingStarted(userContext))
			{
				try
				{
					DataServiceController.Current.SetRequestProcessingState(userContext, false);
					UserDataCache.UserDataEnvelope userDataEnvelope = DataServiceController.Current.UserDataCache.Get(userContext);
					using (userDataEnvelope)
					{
						userDataEnvelope.Data.Usage.RequestProcessed();
					}
					TraceHelper.Current.RequestProcessingEnd();
				}
				finally
				{
					DataServiceController.Current.UserDataCache.TryUnlockKey(userContext);
					TraceHelper.Current.DebugMessage("QuotaSystem.ProcessedRequestHandler exited");
				}
				return;
			}
			else
			{
				TraceHelper.Current.DebugMessage("QuotaSystem.ProcessedRequestHandler IsRequestProcessingStarted returned false");
				return;
			}
		}
        /// <summary>
        /// Invoke request start event
        /// </summary>
        /// <param name="sender">Sender, i.e. data service instance.</param>
        /// <param name="e">event arg</param>
        internal void InvokeProcessingRequest(object sender, DataServiceProcessingPipelineEventArgs e)
        {
#if DEBUG
            this.AssertInitialDebugState();
            this.ProcessingRequestInvokeCount++;
#endif
            if (this.ProcessingRequest != null)
            {
                this.ProcessingRequest(sender, e);
            }
        }
        /// <summary>
        /// Invoke request end event
        /// </summary>
        /// <param name="sender">Sender, i.e. data service instance.</param>
        /// <param name="e">event arg</param>
        internal void InvokeProcessedRequest(object sender, DataServiceProcessingPipelineEventArgs e)
        {
#if DEBUG
            Debug.Assert(!this.HasDisposedProviderInterfaces, "!this.HasDisposedProviderInterfaces");
            Debug.Assert(this.OnStartProcessingRequestInvokeCount > 0, "this.OnStartProcessingRequestInvokeCount > 0");
            Debug.Assert(this.ProcessingRequestInvokeCount == 1, "this.ProcessingRequestInvokeCount == 1");
            Debug.Assert(this.ProcessedRequestInvokeCount == 0, "this.ProcessedRequestInvokeCount == 0");
            if (!this.SkipDebugAssert)
            {
                Debug.Assert(this.ProcessingChangesetInvokeCount == this.ProcessedChangesetInvokeCount, "this.ProcessingChangesetInvokeCount == this.ProcessedChangesetInvokeCount");
            }

            this.ProcessedRequestInvokeCount++;
#endif
            if (this.ProcessedRequest != null)
            {
                this.ProcessedRequest(sender, e);
            }
        }
Example #6
0
        /// <summary>
        /// Invoke request end event
        /// </summary>
        /// <param name="sender">Sender, i.e. data service instance.</param>
        /// <param name="e">event arg</param>
        internal void InvokeProcessedRequest(object sender, DataServiceProcessingPipelineEventArgs e)
        {
#if DEBUG
            Debug.Assert(!this.HasDisposedProviderInterfaces, "!this.HasDisposedProviderInterfaces");
            Debug.Assert(this.OnStartProcessingRequestInvokeCount > 0, "this.OnStartProcessingRequestInvokeCount > 0");
            Debug.Assert(this.ProcessingRequestInvokeCount == 1, "this.ProcessingRequestInvokeCount == 1");
            Debug.Assert(this.ProcessedRequestInvokeCount == 0, "this.ProcessedRequestInvokeCount == 0");
            if (!this.SkipDebugAssert)
            {
                Debug.Assert(this.ProcessingChangesetInvokeCount == this.ProcessedChangesetInvokeCount, "this.ProcessingChangesetInvokeCount == this.ProcessedChangesetInvokeCount");
            }

            this.ProcessedRequestInvokeCount++;
#endif
            if (this.ProcessedRequest != null)
            {
                this.ProcessedRequest(sender, e);
            }
        }
Example #7
0
        /// <summary>
        /// Invoke request start event
        /// </summary>
        /// <param name="sender">Sender, i.e. data service instance.</param>
        /// <param name="e">event arg</param>
        internal void InvokeProcessingRequest(object sender, DataServiceProcessingPipelineEventArgs e)
        {
#if DEBUG
            this.AssertInitialDebugState();
            this.ProcessingRequestInvokeCount++;
#endif
            if (this.ProcessingRequest != null)
            {
                this.ProcessingRequest(sender, e);
            }
        }
Example #8
0
		public static void ProcessingRequestHandler(object source, DataServiceProcessingPipelineEventArgs args)
		{
			UserData userDatum = null;
			TraceHelper.Current.DebugMessage("QuotaSystem.ProcessingRequestHandler entered");
			if (args != null && args.OperationContext != null)
			{
				TraceHelper.CorrelateWithClientRequestId(args.OperationContext);
			}
			UserContext userContext = new UserContext(CurrentRequestHelper.Identity, CurrentRequestHelper.Certificate);
			if (!DataServiceController.Current.IsRequestProcessingStarted(userContext))
			{
				UserDataCache.UserDataEnvelope userDataEnvelope = DataServiceController.Current.UserDataCache.Get(userContext);
				using (userDataEnvelope)
				{
					UserQuota userQuota = DataServiceController.Current.GetUserQuota(userContext);
					if (args != null)
					{
						Guid activityId = EtwActivity.GetActivityId();
						args.OperationContext.ResponseHeaders.Add("request-id", activityId.ToString());
					}
					if (userDataEnvelope.Data.Usage.QuotaCheckAndUpdate(userContext, userQuota))
					{
						DataServiceController.Current.UserDataCache.TryLockKey(userContext, out userDatum);
					}
					else
					{
						throw new DataServiceException(0x193, ExceptionHelpers.GetDataServiceExceptionMessage(HttpStatusCode.Forbidden, Resources.UserQuotaExceeded, new object[0]));
					}
				}
				DataServiceController.Current.SetRequestProcessingState(userContext, true);
				TraceHelper.Current.RequestProcessingStart();
				DataServiceController.Current.UserDataCache.Trace();
				TraceHelper.Current.DebugMessage("QuotaSystem.ProcessingRequestHandler exited");
				return;
			}
			else
			{
				TraceHelper.Current.DebugMessage("QuotaSystem.ProcessingRequestHandler IsRequestProcessingStarted returned true");
				return;
			}
		}