public Task <ExecutionResult> ExecuteAsync(Action <ExecutionOptions> configure, Type rootType) { var schema = _schemaResolver.GetSchema(rootType); var executor = new DocumentExecuter(); return(executor.ExecuteAsync(_ => { _.Schema = schema; _.UserContext = new Dictionary <string, object>() { { "serviceProvider", _scopedServiceProviderResolver.GetProvider() } }; configure(_); })); }
public async Task Invoke(HttpContext httpContext, IScopedServiceProviderResolver scopedServiceProviderResolver) { // If its not a ws or the path does not match ignore if (!httpContext.Request.Path.StartsWithSegments(_path) || !httpContext.WebSockets.IsWebSocketRequest) { await _next(httpContext); return; } var socket = await httpContext.WebSockets.AcceptWebSocketAsync("graphql-ws"); if (!httpContext.WebSockets.WebSocketRequestedProtocols.Contains(socket.SubProtocol)) { await socket.CloseAsync( WebSocketCloseStatus.ProtocolError, "Server only supports graphql-ws protocol", httpContext.RequestAborted); return; } var serviceProvider = scopedServiceProviderResolver.GetProvider(); using (var realTimeExecutionManager = new RealTimeExecutionManager(serviceProvider, _rootType)) { await RunConnectionAsync(realTimeExecutionManager, socket, default); } }
public GraphqlInAppCacheService( CacheConfiguration cacheConfiguration, ICachePolicy cachePolicy, IScopedServiceProviderResolver serviceProviderResolver) { _cacheConfiguration = cacheConfiguration; _cachePolicy = cachePolicy; switch (cacheConfiguration.ResponseCache) { case ResponseCacheType.Memory: _memoryCache = serviceProviderResolver.GetProvider().GetService <IMemoryCache>(); break; case ResponseCacheType.Distributed: _distributedCache = serviceProviderResolver.GetProvider().GetService <IDistributedCache>(); break; } }
public GraphqlCreator(IScopedServiceProviderResolver serviceProviderResolver) { _serviceProvider = serviceProviderResolver.GetProvider(); }