5.2.0.304
Speed improvements
This release includes minor speed optimization. Functionality of HierarchicalLifetimeStrategy
and LifetimeStrategy
were merged into one step to eliminate one iteration in strategy chain and improve speed of objects creation. All logic is implemented in LifetimeStrategy
class.
New Features:
New InjectionConstructor(params Type[] types)
Injection constructor could be specified by providing either arguments or types of arguments of the constructor:
Select default constructor:
container.RegisterType<SomeType>(new InjectionConstructor());
Select constructor with SomeType(int, string, float) signature and provide values:
container.RegisterType<SomeType>(new InjectionConstructor(0, string.Empty, 0.0f));
Select constructor with SomeType(string, string, string) signature and provide values for last two:
container.RegisterType<SomeType>(
new InjectionConstructor(
new ResolvedParameter(typeof(string)), string.Empty, string.Empty)));
Select constructor with SomeType(string, string, IUnityContainer) signature and provide values for last two:
container.RegisterType<SomeType>(
new InjectionConstructor(new Type[] { typeof(string), typeof(string), typeof(IUnityContainer) })));
Note: This change could be breaking and affect selection of a constructor with all parameters of type Type: Constructor(Type type1, Type type2)
Changes to HierarchicalLifetimeManager
Class HierarchicalLifetimeManager
now implements IHierarchicalLifetimePolicy
interface.
This interface adds method CrateScope()
and allows registration of hierarchical lifetime managers with child containers.
RegisterSingleton<>()
Added lineup of extension methods for registering Singletons