Update FactoryRegistration with ResolveDelegate signature
Description
Original factory delegate had following signature:
object Factory(IUnityContainer container, Type type, string name);
When resolving, this delegate would get a reference to a container and would be passed a type and a name of contract requested. The delegate supposed to create requested instance and return it.
Problem
This type of delegate does not allow passing any overrides as well as it would not account for any Per-Resolve lifetime managers during resolution.
Solution
Unity Container used ResolveDelegate delegates to perform resolutions. This new mechanism supports all build in features of the container and allows overriding of resolved values.
New signature of resolution function should be as follows:
object? resolver(IResolveContext context);
Interface IUnityContainer should be updated accordingly:
IUnityContainer RegisterFactory(Type type, string? name, Func<IResolveContext, object?> factory, IFactoryLifetimeManager? lifetimeManager);
Impact
Legacy registrations will be supported through extension methods.