diff --git a/samples/MediatR.Examples.DryIoc/Program.cs b/samples/MediatR.Examples.DryIoc/Program.cs index 845c743b..55fba1a7 100644 --- a/samples/MediatR.Examples.DryIoc/Program.cs +++ b/samples/MediatR.Examples.DryIoc/Program.cs @@ -20,12 +20,17 @@ static Task Main() private static IMediator BuildMediator(WrappingWriter writer) { var container = new Container(); + // Since Mediator has multiple constructors, consider adding rule to allow that + // var container = new Container(rules => rules.With(FactoryMethod.ConstructorWithResolvableArguments)) container.Use(writer); //Pipeline works out of the box here container.RegisterMany(new[] { typeof(IMediator).GetAssembly(), typeof(Ping).GetAssembly() }, Registrator.Interfaces); + //Without the container having FactoryMethod.ConstructorWithResolvableArguments commented above + //You must select the desired constructor + container.Register(made: Made.Of(() => new Mediator(Arg.Of()))); var services = new ServiceCollection();