コード例 #1
0
        public GlimpseMiddleware(Func<IDictionary<string, object>, Task> innerNext, IServiceProvider globalServices, Func<IHttpContext, bool> shouldRun)
        {
            var typeActivator = globalServices.GetService<ITypeActivator>();
             
            _innerNext = innerNext;
            _globalServices = globalServices;
            _runtime = typeActivator.CreateInstance<RequestRuntimeHost>();
            _contextData = new ContextData<MessageContext>();

            // TODO: Need to find a way/better place for 
            var settings = new Settings();
            if (shouldRun != null) {
                settings.ShouldProfile = context => shouldRun((HttpContext)context);
            }
            _settings = settings;
        }
コード例 #2
0
        public GlimpseMiddleware(RequestDelegate innerNext, IServiceProvider serviceProvider, Func<IHttpContext, bool> shouldRun)
        {
            _innerNext = innerNext;

            var typeActivator = serviceProvider.GetService<ITypeActivator>();
             
            _runtime = typeActivator.CreateInstance<RequestRuntimeHost>(); 
            _contextData = new ContextData<MessageContext>();

            // TODO: Need to find a way/better place for 
            var settings = new Settings();
            if (shouldRun != null)
            {
                settings.ShouldProfile = context => shouldRun((HttpContext)context);
            }
            _settings = settings;
        }