Installation & Setup
Installation & Setup
Section titled “Installation & Setup”Prerequisites
Section titled “Prerequisites”Before starting, ensure you have:
- .NET SDK (supports .NET 8.0, 9.0, and 10.0+)
- PostgreSQL database (for persistent event store)
- dbmate (optional, but highly recommended for migration management)
Installing the NuGet Package
Section titled “Installing the NuGet Package”Add the NuGet package Sharpino to your project:
dotnet add package Sharpino[!NOTE] If you encounter compilation errors like
"A function labeled with the 'EntryPointAttribute' attribute must be the last declaration", you can fix it by adding the following line to your.fsprojfile:<GenerateProgramFile>false</GenerateProgramFile>
Project Template Installation
Section titled “Project Template Installation”You can bootstrap a project quickly using the official dotnet templates:
# Install the templatesdotnet new install Sharpino.Templates
# Create a new projectdotnet new sharpinoThis sets up a minimal project template including a docker-compose configuration for Postgres.
Database Configuration
Section titled “Database Configuration”- dbmate templates: Sharpino samples use
dbmatetemplates to configure Postgres tables for event and snapshot storage. - Environment Variables: Set up a
.envfile in your project root containing the database connection URL:DATABASE_URL=postgres://username:password@localhost:5432/db_name?sslmode=disable - Run Migrations: Run the migration tool:
Terminal window dbmate up
Running Tests
Section titled “Running Tests”Once the database and environment variables are ready, you can run all the sample tests via:
runTests.shTo run a single project, navigate to its test folder, configure the .env file, and execute:
dotnet testRabbitMQ Integration (Optional)
Section titled “RabbitMQ Integration (Optional)”Some examples support integration with RabbitMQ. Make sure RabbitMQ is running (e.g., rabbitmq-server), and run the subproject with:
dotnet run --configuration:rabbitmq