Aquifer Server is the back-end server allowing access to data in the Aquifer.
- Make sure you have the .NET 8 SDK installed
dotnet restore
Copy appsettings.example.json
as appsettings.Development.json
and provide the values needed for your instance.
If you want multiple instances of this file, create them per environment and set your ASPNETCORE_ENVIRONMENT
accordingly. For example: dotnet run --environment Production
. Environment configurations have no reason
to be checked in.
# with hot reload
dotnet watch run --project src/Aquifer.API
# normal mode
dotnet run --project src/Aquifer.API
If you want to use the REPL outside of an IDE, csharprepl is a good option.
# install
dotnet tool install -g csharprepl
# run
csharprepl
Then load the project from the csharprepl prompt: #r "src/Aquifer.API/Aquifer.API.csproj"
dotnet build --no-incremental /p:WarningsAsErrors=true
Important: Initialize the settings file in the src/Aquifer.Migrations
directory by copying appsettings.example.json
as appsettings.Development.json
and providing
the values needed for your instance.
Entity Framework will generate migrations by comparing the C# Entities defined in the project and the current state of the database.
First, create your entity in the Aquifer.Data/Entities
directory.
Next, add your entity definition to the src/Aquifer.Data/AquiferDbContext.cs
file.
Entities are listed in an alphabetical order.
To create a new migration, run:
dotnet ef migrations add --startup-project src/Aquifer.Migrations --project src/Aquifer.Data <MigrationNameHere>
Your new migration will be created in the src/Aquifer.Data/Migrations
directory along with the .Designer
file and updated AquiferDbContextModelSnapshot.cs
file.
If you run that command and the new migration file is empty, that means there were no changes detected between the C# Entities and the database. You can use this to your advantage to create empty migrations and add your own custom code.
To run migrations and add your changes to the DB, run:
dotnet ef database update --startup-project src/Aquifer.Migrations --project src/Aquifer.Data
# unit tests
dotnet test
We use Azure Storage Queues and Azure Functions for queueing and running jobs. To develop locally, you'll need Azurite and Azure Function Core Tools.
- Run Azurite so that you can have local queues. In the
aquifer-server
dir, runazurite
. - Run Aquifer.Jobs using the function core tools. In the
aquifer-server/src/Aquifer.Jobs
runfunc start
.