private IEnumerable <MemberDeclarationSyntax> GenerateFields() { yield return(CodeModel.TypenameProperty(_inputObjectType.Name)); var fields = _schema.GetInputFields(_inputObjectType); foreach (var fieldDefinition in fields) { var fieldName = fieldDefinition.Key.ToFieldResolverName(); var fieldTypeName = CodeModel.SelectFieldTypeName(_schema, _inputObjectType, fieldDefinition); yield return(PropertyDeclaration( IdentifierName(fieldTypeName), Identifier(fieldName)) .WithModifiers( TokenList( Token(SyntaxKind.PublicKeyword))) .WithLeadingTrivia(CodeModel.ToXmlComment(fieldDefinition.Value.Description)) .WithAccessorList( AccessorList( List( new[] { AccessorDeclaration( SyntaxKind.GetAccessorDeclaration) .WithSemicolonToken( Token(SyntaxKind.SemicolonToken)), AccessorDeclaration( SyntaxKind.SetAccessorDeclaration) .WithSemicolonToken( Token(SyntaxKind.SemicolonToken)) })))); } yield return(GenerateRead()); }
private IEnumerable <MemberDeclarationSyntax> GenerateProperties() { var props = new List <MemberDeclarationSyntax> { CodeModel.TypenameProperty(_unionType.Name) }; /*var fields = _schema.GetFields(_unionType); * * foreach (var field in fields) * { * if (ObjectTypeAbstractControllerBaseGenerator.IsAbstract( * _schema, * _unionType, * field)) * continue; * * props.Add(GenerateProperty(field)); * }*/ return(props); }
private IEnumerable <MemberDeclarationSyntax> GenerateProperties() { var props = new List <MemberDeclarationSyntax>(); props.Add(CodeModel.TypenameProperty(_interfaceType.Name)); var fields = _schema.GetFields(_interfaceType); foreach (var field in fields) { if (ObjectTypeAbstractControllerBaseGenerator.IsAbstract( _schema, _interfaceType, field)) { continue; } props.Add(GenerateProperty(field)); } return(props); }