Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

ASP.net core and graphQL

$
0
0

I have build an asp.net core project which get Rest API calls and return data.

now I added a GraphQL option as well, and I have some issue not clear :

1. when I run the project and go to http://localhost:61171/ui/playground 

In my Query and Type class I put a breakpoint which I see something is calling this all the time over and and over.

2. in my Type class I tried to set a Field which returns a List of Data

a. I get an error :

System.ArgumentException: 'The GraphQL type for Field: 'Items' on parent type: 'GetReportType' could not be derived implicitly.

how should i set this field? is it possible to give the client to query only specific properties :

public List<Report> Items { get; set; }


public class Report
    {
        public string RefID{ get; set; }
        public DateTime CreateTime { get; set; }
        public string Text { get; set; }
}

==>I solved this issue #2 by define: Field<ListGraphType<ReportType>>("items");

3. how can i read a KEY which sent in the HEADER and called "MYKEY"

==> this is (#3) solved based on this https://stackoverflow.com/a/53214052/9698435

in the Query class?

thanks for the help


Viewing all articles
Browse latest Browse all 9386

Trending Articles