public static IQueryDescriptor Get(Type queryType)
        {
            IQueryDescriptor descriptor = null;

            if (_descriptorsByQueryType.TryGetValue(queryType, out descriptor))
            {
                return(descriptor);
            }

            return(null);
        }
        public ModelGeneratorContext(
            ISchema schema,
            IQueryDescriptor query,
            string clientName,
            string ns)
        {
            Schema     = schema ?? throw new ArgumentNullException(nameof(schema));
            Query      = query ?? throw new ArgumentNullException(nameof(query));
            ClientName = clientName ?? throw new ArgumentNullException(nameof(clientName));
            Namespace  = ns ?? throw new ArgumentNullException(nameof(ns));

            _collector = new FieldCollector(
                schema,
                new FragmentCollection(schema, query.OriginalDocument));
        }
        public CodeModelGenerator(
            ISchema schema,
            IQueryDescriptor query,
            ISet <string> usedNames,
            string clientName,
            string ns)
        {
            _schema     = schema ?? throw new ArgumentNullException(nameof(schema));
            _query      = query ?? throw new ArgumentNullException(nameof(query));
            _usedNames  = usedNames ?? throw new ArgumentNullException(nameof(usedNames));
            _clientName = clientName ?? throw new ArgumentNullException(nameof(clientName));
            _namespace  = ns ?? throw new ArgumentNullException(nameof(ns));

            _document       = query.OriginalDocument;
            _fieldCollector = new FieldCollector(
                new FragmentCollection(schema, query.OriginalDocument));

            Descriptors = Array.Empty <ICodeDescriptor>();
            FieldTypes  = new Dictionary <FieldNode, string>();
        }
Beispiel #4
0
 public OperationDescriptor(
     string name,
     string ns,
     ObjectType operationType,
     OperationDefinitionNode operation,
     IReadOnlyList <IArgumentDescriptor> arguments,
     IQueryDescriptor query,
     ICodeDescriptor resultType)
 {
     Name = name
            ?? throw new ArgumentNullException(nameof(name));
     Namespace     = ns ?? throw new ArgumentNullException(nameof(ns));
     OperationType = operationType
                     ?? throw new ArgumentNullException(nameof(operationType));
     Operation = operation
                 ?? throw new ArgumentNullException(nameof(operation));
     Arguments = arguments
                 ?? throw new ArgumentNullException(nameof(arguments));
     Query = query
             ?? throw new ArgumentNullException(nameof(query));
     ResultType = resultType
                  ?? throw new ArgumentNullException(nameof(resultType));
 }
Beispiel #5
0
 public static void Add(Type queryType, IQueryDescriptor descriptor)
 {
     _descriptorsByQueryType.Add(queryType, descriptor);
 }
 public static void Add(Type queryType, IQueryDescriptor descriptor)
 {
     _descriptorsByQueryType.Add(queryType, descriptor);
 }
 public static TResult Execute <TResult>(this IQueryDescriptor <TResult> queryDescriptor)
 {
     return(queryDescriptor.Execute(Criterion.Empty));
 }
 public static TResult ByIdList <TResult, TIdType>(this IQueryDescriptor <TResult> queryDescriptor, params TIdType[] id)
 {
     return(queryDescriptor.Execute(Criterion.IdList(id)));
 }
 public static TResult ById <TResult, TIdType>(this IQueryDescriptor <TResult> queryDescriptor, TIdType id)
 {
     return(queryDescriptor.Execute(Criterion.Id(id)));
 }