Skip to content

senapatisantosh/DotnetGraphQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DotnetGraphQL

A .NET 8 GraphQL API service built with Hot Chocolate and Entity Framework Core.

Features

  • GraphQL queries with filtering, sorting, and projections
  • GraphQL mutations for CRUD operations
  • Entity Framework Core with in-memory database
  • Seeded sample data (Books and Authors)
  • Integration tests

Getting Started

# Run the API
cd src/DotnetGraphQL.Api
dotnet run

Navigate to https://localhost:5001/graphql to access the Banana Cake Pop GraphQL IDE.

Example Queries

# Get all books
{
  books {
    id
    title
    genre
    publishedYear
    author {
      name
    }
  }
}

# Get a specific author with their books
{
  authorById(id: 1) {
    name
    bio
    books {
      title
      publishedYear
    }
  }
}

# Add a new book
mutation {
  addBook(title: "New Book", genre: "Fiction", publishedYear: 2024, authorId: 1) {
    id
    title
  }
}

Running Tests

dotnet test

Project Structure

DotnetGraphQL/
├── src/DotnetGraphQL.Api/
│   ├── Models/          # Entity models (Book, Author)
│   ├── Data/            # EF Core DbContext with seed data
│   ├── GraphQL/
│   │   ├── Types/       # GraphQL type definitions
│   │   ├── Queries/     # GraphQL query resolvers
│   │   └── Mutations/   # GraphQL mutation resolvers
│   └── Program.cs       # App configuration
└── tests/DotnetGraphQL.Tests/
    └── GraphQLTests.cs  # Integration tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages