Skip to content

gonzdn/DDD.NET.CORE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Net Core 5 Basic DDD Architecture with GraphQL

Basic DDD structure with GraphQL to refer as a base project to understand better how this works.

Installation

Pretty straightforward, just modify the appsettings.json file located on GraphQLServer and DDD.NET.CORE.API projects by replacing your database connection.

DDD.NET.CORE.API/appsettings.json

GraphQLServer/appsettings.json

Usage

  1. Set the DDD.NET.CORE.API as the main project on the presentation layer
  2. Open package administrator console, set the default project as DDD.NET.CORE.INFRAESTRUCTURE and apply the following commands:
add-migration Initial
update-database
  1. Run the project after replacing the appsettings.json

Nugget libraries used on the DDD project:

Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.Extensions.Configuration
Microsoft.Extensions.Configuration.Json
Swashbuckle.AspNetCore

Nugget libraries used on the GraphQL project:

HotChocolate.AspNetCore
HotChocolate.AspNetCore.Playground
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
  1. When using GraphQL, set GraphQLServer as default project, then run again. To open Playground and start testing GraphQL make sure to access the following URL, then paste the queries attached below and click the play button on playground client.
https://localhost:44371/playground/
#Get all cars
query{
  cars{
    id
    name
    model
    engine
  }
}

#Create a car
mutation {
  create(car: {name:"FordCar", model:"Ford", engine:"V34"}){
    name
    model
    engine
  }
}

#Delete a car
mutation {
  delete(deleteCar:{id:2})
  }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

Basic DDD structure with GraphQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published