Skip to content

Building and Development

Stelio Kontos edited this page Sep 25, 2023 · 7 revisions

Interested in contributing to PetaPoco? Here you will find a brief overview of the development tools and testing environment used, and how to get set up and start contributing.

Development Environment

Development can be done in either Visual Studio 2022 or VSCode. Both are well-suited for PetaPoco development, so you can choose the one you're most comfortable with. If using VSCode, there are a couple extensions you need installed for C# intellisense, building and testing. These, along with preconfigured launch settings and tasks, are included in ".vscode" configuration folder.

Additional Software

For integration testing, we use Docker containers to ensure consistent testing across the various databases that PetaPoco supports - MS SQL Server, MySQL, MariaDB, Firebird, and PostgreSQL - without cluttering your personal development environment. If you don't have it installed already, you will need to install Docker Desktop (free download).

Integration and Unit Tests are currently being added to our CI/CD pipeline as well.

Setting Up Your Development Environment

The first order of business, naturally, is to clone the PetaPoco repository to your local machine. Once that's done, open the project in your chosen IDE - either Visual Studio 2022 or VSCode - and restore all the required NuGet packages or rebuild the solution:

# Clone PetaPoco and navigate into the directory
git clone https://github.com/CollaboratingPlatypus/PetaPoco.git && cd PetaPoco

# Pick your poison:
# For Visual Studio 2022, open solution file
start PetaPoco.sln

# OR

# For VSCode, open directory and restore Nuget packages
code . && dotnet restore # VSCode

Running Integration Tests

Docker Setup

If you're new to Docker, it's a tool designed to make it easier to create, deploy, and run applications in a sandboxed environment by using containers. For PetaPoco, Docker is used to run all the DBMS integration tests (with the exception of MS Access). After installing Docker Desktop, simply use the supplied PowerShell scripts included in the root directory to start and stop the containers (referred to as "up" and "down" in the Docker build scripts).

Alternatively, VSCode has fantastic support for managing container images. Simply right-click "docker-compose.yml" and launch the container, or pick a specific image depending on which tests you intend to run.

SQLite for Quick Local Tests

For quick local tests on a Windows environment, SQLite is your friend. It's lightweight, fast, and doesn't require you to set up a Docker container, making it convenient for quick iterations. SQLite allows for rapid testing, often completing all integration tests in under a minute on modern hardware.

MS Access Setup

The only DBMS not currently containerized is MS Access, which is currently supported as of PetaPoco v6. If you're planning to run MS Access tests, you'll also need to install the MS Access Database Engine 2010 Redistributable directly from Microsoft's website.

Note that MS SQL Server Compact Edition (SQL CE 4.0) has reached the end of it's fixed lifecycle policy, and is no longer included in the integration testing, although some unofficial support will remain for backward compatibility.

Contributing Code

When it comes to contributing code, PetaPoco follows a feature branching strategy. Create a new branch for each feature or bugfix you're working on. Once you're done, make a pull request to the "Development" branch. For more on writing tests, contributing guidelines and more, see the relevant topics in our Wiki pages.

Contributions from the community are what make PetaPoco the versatile and robust micro-ORM it's known for. Whether you're fixing bugs, adding features, or improving documentation, your efforts are highly valued. For more detailed guidelines, please refer to the project's contribution guide.