public HttpContext Create(IFeatureCollection featureCollection) { PooledHttpContext httpContext = null; lock (_pool) { if (_pool.Count != 0) { httpContext = _pool.Pop(); } } if (httpContext == null) { httpContext = new PooledHttpContext(featureCollection); } else { httpContext.Initialize(featureCollection); } if (_httpContextAccessor != null) { _httpContextAccessor.HttpContext = httpContext; } return httpContext; }
public HttpContext Create(IFeatureCollection featureCollection) { if (featureCollection == null) { throw new ArgumentNullException(nameof(featureCollection)); } PooledHttpContext httpContext = null; lock (_pool) { if (_pool.Count != 0) { httpContext = _pool.Pop(); } } if (httpContext == null) { httpContext = new PooledHttpContext(featureCollection); } else { httpContext.Initialize(featureCollection); } if (_httpContextAccessor != null) { _httpContextAccessor.HttpContext = httpContext; } return(httpContext); }
public HttpContext Create(IFeatureCollection featureCollection) { if (featureCollection == null) { throw new ArgumentNullException(nameof(featureCollection)); } var responseCookiesFeature = new ResponseCookiesFeature(featureCollection, _builderPool); featureCollection.Set<IResponseCookiesFeature>(responseCookiesFeature); PooledHttpContext httpContext = null; lock (_pool) { if (_pool.Count != 0) { httpContext = _pool.Pop(); } } if (httpContext == null) { httpContext = new PooledHttpContext(featureCollection); } else { httpContext.Initialize(featureCollection); } if (_httpContextAccessor != null) { _httpContextAccessor.HttpContext = httpContext; } return httpContext; }
public HttpContext Create(IFeatureCollection featureCollection) { if (featureCollection == null) { throw new ArgumentNullException(nameof(featureCollection)); } var responseCookiesFeature = new ResponseCookiesFeature(featureCollection, _builderPool); featureCollection.Set <IResponseCookiesFeature>(responseCookiesFeature); PooledHttpContext httpContext = null; lock (_pool) { if (_pool.Count != 0) { httpContext = _pool.Pop(); } } if (httpContext == null) { httpContext = new PooledHttpContext(featureCollection); } else { httpContext.Initialize(featureCollection); } if (_httpContextAccessor != null) { _httpContextAccessor.HttpContext = httpContext; } return(httpContext); }