EntityInjector is a set of libraries designed to simplify extracting entities from (primarily) databases in a clean and dependency-injected way.
👉 This repository contains multiple NuGet packages:
EntityInjector.Route
— Route binding to entities (via HTTP context)EntityInjector.Property
— (coming soon)
Package | NuGet | Description |
---|---|---|
EntityInjector.Route | Bind route parameters directly to database entities |
We provide samples using Postgres + EF Core + TestContainers.
See: EntityInjector.Samples.PostgresTest
- Requires .NET 8 SDK
- Tests use docker containers
- Add Cosmos DB sample
- Extend tests + failure scenarios
- Exception handling
This sample demonstrates how to use EntityInjector with a Postgres database using Entity Framework Core and TestContainers.
It shows how to bind route parameters directly to entities using dependency injection.
- Docker installed and running
- .NET 8 SDK installed
- From the repository root, start the database using Docker Compose:
docker compose up --build
This will create a Postgres container and run init.sql
to seed the database with test data.
- From the sample project directory, build and run the tests:
dotnet clean && dotnet restore && dotnet test