Home > Software engineering >  GraphQL : Not Getting EF Related objects after implementing Types
GraphQL : Not Getting EF Related objects after implementing Types

Time:10-20

For background, I am following the tutorial here: https://www.youtube.com/watch?v=HuN94qNwQmM .

As the code is too long I am putting that in git https://github.com/dikeshkumar135/CommandERGQL

Now, coming to the problem, when I am making request with this body

    query{
     platform{
       id,
       name,
       commands{
         howTo
       }
     }
    }

I am getting the data for platform with commands value as null and the below error:

{
  "message": "There was no argument with the name `platform` found on the field `commands`.",
  "locations": [
    {
      "line": 5,
      "column": 5
    }
  ],
  "path": [
    "platform",
    1,
    "commands"
  ],
  "extensions": {
    "fieldName": "commands",
    "argumentName": "platform"
  }

If I remove the type it's working fine, but if I add type then the problem occurs to get related objects.

CodePudding user response:

I downgraded hotchocolate packages from 12.0.1 to 11.0.8 ad it worked. It was a suggestion to my comment in youtube.

CodePudding user response:

if you don't have goal to update data, you can omit to use EF and use, just for exmaple, NReco.GraphQL to set up graphql schema (including relation between schema objects) via json-style definition. Setting db-connection quite easy and under the hood it's ORM.

  • Related