Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions samples/MediatR.Examples.DryIoc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TextWriter>(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<IMediator, Mediator>(made: Made.Of(() => new Mediator(Arg.Of<IServiceProvider>())));

var services = new ServiceCollection();

Expand Down