コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphTypeProvider" /> class.
 /// </summary>
 /// <param name="serviceProvider">The service provider.</param>
 /// <param name="attributeAccessor">The attribute accessor.</param>
 /// <param name="optionsAccessor">The options accessor.</param>
 public GraphTypeProvider(IServiceProvider serviceProvider, IAttributeAccessor attributeAccessor, IOptions <GraphOptions> optionsAccessor)
 {
     _serviceProvider    = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     _attributeAccessor  = attributeAccessor ?? throw new ArgumentNullException(nameof(attributeAccessor));
     _graphTypes         = new Dictionary <string, IGraphType>();
     _fieldNameConverter = Guard.ArgumentNotNull(optionsAccessor, nameof(optionsAccessor)).Value.FieldNameConverter;
     foreach (var scalarType in GraphValueResolver.ScalarTypes)
     {
         GetGraphType(scalarType, null, false);
     }
 }
コード例 #2
0
 public DefaultGraphContextFactory(
     IDocumentBuilder documentBuilder,
     IGraphSchemaProvider schemaProvider,
     IGraphTypeProvider graphTypeProvider,
     IHttpContextAccessor httpContextAccessor,
     ISelectionSetProvider selectionSetProvider,
     IOptions <GraphOptions> optionsAccessor)
 {
     _documentBuilder      = documentBuilder ?? throw new ArgumentNullException(nameof(documentBuilder));
     _schemaProvider       = schemaProvider ?? throw new ArgumentNullException(nameof(schemaProvider));
     _graphTypeProvider    = graphTypeProvider ?? throw new ArgumentNullException(nameof(graphTypeProvider));
     _httpContextAccessor  = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
     _selectionSetProvider = selectionSetProvider ?? throw new ArgumentNullException(nameof(selectionSetProvider));
     _options            = Guard.ArgumentNotNull(optionsAccessor, nameof(optionsAccessor)).Value;
     _fieldNameConverter = _options.FieldNameConverter;
 }
コード例 #3
0
 public SelectionSetProvider(
     IGraphTypeProvider graphTypeProvider,
     IGraphSchemaProvider schemaProvider,
     IQueryResultTypeGenerator typeGenerator,
     ILogger <SelectionSetProvider> logger,
     IOptions <GraphOptions> optionsAccessor)
 {
     Guard.ArgumentNotNull(schemaProvider, nameof(schemaProvider));
     _graphTypeProvider  = graphTypeProvider ?? throw new ArgumentNullException(nameof(graphTypeProvider));
     _selections         = new ConcurrentDictionary <string, ICollection <ISelectionNode> >();
     _typeGenerator      = Guard.ArgumentNotNull(typeGenerator, nameof(typeGenerator));
     _schema             = schemaProvider.Schema;
     _fieldNameConverter = Guard.ArgumentNotNull(optionsAccessor, nameof(optionsAccessor)).Value.FieldNameConverter;
     _logger             = Guard.ArgumentNotNull(logger, nameof(logger));
     _log4MissCache      = LoggerMessage.Define <DateTimeOffset, string, string>(LogLevel.Trace, 0, "[{0}]Selection set cache missing. Operation: {1}; Reason: {2}.");
 }
コード例 #4
0
 public GraphSchemaFormatter(IGraphTypeProvider graphTypeProvider, IOptions <GraphOptions> optionsAccessor)
 {
     Guard.ArgumentNotNull(optionsAccessor, nameof(optionsAccessor));
     _fieldNameConverter = optionsAccessor.Value.FieldNameConverter;
     _graphTypeProvider  = graphTypeProvider ?? throw new ArgumentNullException(nameof(graphTypeProvider));
 }