Cocona icon indicating copy to clipboard operation
Cocona copied to clipboard

Cocona.Command.Binder.CoconaParameterBinder does not support scoped services

Open bricktror opened this issue 2 years ago • 0 comments

Since Cocona.Command.Binder.CoconaParameterBinder injects the root IServiceProvider, using a FromServiceAttribute with a scoped service will fail

(Untested) Example:

var builder = CoconaApp.CreateBuilder(args);
builder.Services.AddScoped<IFoo, Foo>();
var app = builder.Build();
app.AddCommand("foo", ([FromService]IFoo foo) => {});
app.Run();

bricktror avatar Aug 01 '22 11:08 bricktror