///<summary>Construct an instance bound to the currently executing http request. The id of the current request will be extracted using the supplied <see cref="IHttpRequestIdFetcher"/></summary>
        public SingleHttpRequestUseGuard(IHttpRequestIdFetcher httpRequestIdFetcher)
        {
            Contract.Requires(httpRequestIdFetcher != null);

            _httpRequestIdFetcher = httpRequestIdFetcher;
            _initialRequestId = httpRequestIdFetcher.GetCurrent();
        }
示例#2
0
        ///<summary>Construct an instance bound to the currently executing http request. The id of the current request will be extracted using the supplied <see cref="IHttpRequestIdFetcher"/></summary>
        public SingleHttpRequestUseGuard(IHttpRequestIdFetcher httpRequestIdFetcher)
        {
            Contract.Requires(httpRequestIdFetcher != null);

            _httpRequestIdFetcher = httpRequestIdFetcher;
            _initialRequestId     = httpRequestIdFetcher.GetCurrent();
        }
示例#3
0
        ///<summary>Throws an exception if the request has changed since the guard was created.</summary>
        override protected void InternalAssertNoChangeOccurred(object guarded)
        {
            var currentRequestId = _httpRequestIdFetcher.GetCurrent();

            if (_initialRequestId != currentRequestId)
            {
                throw new MultiRequestAccessDetected(guarded, _initialRequestId, currentRequestId);
            }
        }