It can be reproed using DryIoc 5.4.3
new Container(
rules =>
rules.WithFactorySelector(
(request, single, many) =>
{
// Do something here
}));
container.Register<IFoo, Foo>(); // Default
container.Register<IFoo, Foo>("my"); // Keyed
container.Resolve<IFoo>(); // Custom factory selector invoked
container.Resolve<IFoo>("my"); // Custom factory selector NOT invoked
Slightly related, I don't like returning null to tell DryIoc to use the default factory. It's not obvious, and prevents a useful pattern like this:
// Rules.Default.FactorySelector is null so it can't be really used
var defaultFactory = Rules.Default.FactorySelector(request, single, many);
if (IsSpecialType(defaultFactory.ImplementationType))
{
// Return a different factory
}
else
{
return defaultFactory;
};
It can be reproed using DryIoc 5.4.3
Slightly related, I don't like returning
nullto tell DryIoc to use the default factory. It's not obvious, and prevents a useful pattern like this: