This is an example project of how to use GraphQL with EF to query and manipulate with data.
EF will populate person table with 3 entries.
Get started:
Modify your sql server connection string in the appsettings.Development.json
file if needed.
dotnet restore
dotnet build
dotnet run
Open https://localhost:5001 in your browser.
- Query all persons
{
allPersons {
id
name
}
}
- Query person with name
"Rachelle"
{
allPersons(name: "Rachelle") {
id
name
}
}
- Mutation add person
mutation PersonMutation($person: PersonInputType!){
addPerson(person: $person){
id
}
}
Variable:
{
"person":{
"name": "John",
"surname": "Cena"
}
}