Added support for multiple constructors and best match greedy resolution.
Some checks failed
Nuget Pkg Build / build (push) Failing after 25s

This commit is contained in:
Samuele Lorefice
2025-09-21 21:30:41 +02:00
parent e2cc807f70
commit 043cba4b3f
6 changed files with 58 additions and 33 deletions

View File

@@ -10,11 +10,11 @@ It is designed to be used in minimalistic applications, such as console applicat
- **Lightweight**: Minimal codebase with no external dependencies. 1 class, the service container. You don't need anything else.
- **Simple API**: You register services using two methods (one for singletons, one for transients) and resolve them with one.
- **Supports Singleton and Transient lifetimes**: Choose between singleton (one instance per container) and transient (new instance per resolution) lifetimes for your services.
- **Greedy matching constructor selection**: When resolving a service, the constructor with the most parameters that can be satisfied by the container is chosen.
## Limitations
- **No support for scoped lifetimes**
- **No support for property injection or method injection.**
- **Every service should have only 1 constructor.** (planned to be lifted in future versions)
## Usage
````csharp