Basic DDD structure with GraphQL to refer as a base project to understand better how this works.
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
- Set the DDD.NET.CORE.API as the main project on the presentation layer
- Open package administrator console, set the default project as DDD.NET.CORE.INFRAESTRUCTURE and apply the following commands:
add-migration Initial
update-database
- 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
- 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})
}
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.