public ResultBuilderDescriptor( string name, INamedTypeDescriptor resultNamedType, IReadOnlyCollection <ValueParserDescriptor> valueParsers) { _name = name; ResultNamedType = resultNamedType; RuntimeType = new(NamingConventions.CreateResultBuilderName(_name)); ValueParsers = valueParsers; }
/// <summary> /// Describes the DataType /// </summary> /// <param name="graphQLTypeName"> /// /// </param> /// <param name="namespace"> /// /// </param> /// <param name="operationTypes"> /// The types that are subsets of the DataType represented by this descriptor. /// </param> public DataTypeDescriptor( NameString graphQLTypeName, string @namespace, IReadOnlyList <NamedTypeDescriptor> operationTypes, IReadOnlyList <string> implements, bool isInterface = false) { var allProperties = new Dictionary <string, PropertyDescriptor>(); foreach (PropertyDescriptor namedTypeReferenceDescriptor in operationTypes.SelectMany(operationType => operationType.Properties)) { if (!allProperties.ContainsKey(namedTypeReferenceDescriptor.Name)) { if (namedTypeReferenceDescriptor.Type is NonNullTypeDescriptor nonNull) { allProperties.Add( namedTypeReferenceDescriptor.Name, new PropertyDescriptor( namedTypeReferenceDescriptor.Name, nonNull.InnerType) ); } else { allProperties.Add( namedTypeReferenceDescriptor.Name, namedTypeReferenceDescriptor); } } } Properties = allProperties.Select(pair => pair.Value).ToList(); Name = NamingConventions.DataTypeNameFromTypeName(graphQLTypeName); GraphQLTypeName = graphQLTypeName; Namespace = @namespace; Implements = implements; IsInterface = isInterface; }
/// <summary> /// /// </summary> /// <param name="graphQLTypeName"> /// /// </param> /// <param name="namespace"> /// /// </param> /// <param name="operationTypes"> /// The types that are subsets of the EntityType represented by this descriptor. /// </param> public EntityTypeDescriptor( NameString graphQLTypeName, string @namespace, IReadOnlyList <NamedTypeDescriptor> operationTypes) { var allProperties = new Dictionary <string, PropertyDescriptor>(); foreach (PropertyDescriptor namedTypeReferenceDescriptor in operationTypes.SelectMany(operationType => operationType.Properties)) { if (!allProperties.ContainsKey(namedTypeReferenceDescriptor.Name)) { allProperties.Add( namedTypeReferenceDescriptor.Name, namedTypeReferenceDescriptor); } } Properties = allProperties; Name = NamingConventions.EntityTypeNameFromGraphQLTypeName(graphQLTypeName); GraphQLTypeName = graphQLTypeName; Namespace = @namespace; }