Skip to content

Example of using GraphQL with EntityFrameworkCore and Sql

Notifications You must be signed in to change notification settings

brivvirs/netcore_graphql_ef_sql

Repository files navigation

Netcore 2.2 with GraphQL and EntityFrameworkCore MSSQL


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

Playground

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"
    }
}

About

Example of using GraphQL with EntityFrameworkCore and Sql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages