using Ninject.Modules; using System.CommandLine.Invocation; namespace CustomHostingDemo { public class CommandHandlerModule : NinjectModule { public override void Load() { Bind().ToMethod(ctx => CommandContextParameter.FromContext(ctx).Context); Bind().ToMethod(ctx => CommandContextParameter.FromContext(ctx).Args); } } }