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

@@ -21,8 +21,23 @@ interface IOtherService {
class GuidService : IOtherService {
public Guid Id { get; } = Guid.NewGuid();
}
public interface INotRegisteredService {
void DoSomething();
}
class GuidDependantService {
private readonly IService logService;
private readonly IOtherService? guidService;
public GuidDependantService(IService logService, INotRegisteredService guidService) {
this.logService = logService;
}
public GuidDependantService(IService logService, IOtherService guidService) {
this.logService = logService;
this.guidService = guidService;
}
class GuidDependantService(IService logService, IOtherService guidService) {
public void LogWithId(string message) {
logService.Log($"[GuidDependantService] {message} (ID: {guidService.Id})");
}