Resolve a Collection of Customized Class in UnityConfig
Unity supports three ways of registering types:
- Instance registration
- Type registration
- Factory registration
Typically, Instance registration and Type registration resolve
dependencies through ResolvedParameter<T>
, while
Factory registration resolve dependencies by a factory delegate. In
practice, when you want to resolve a List<T>
or
Dictionary<T1, T2>
, Factory registration is what you
want. Let's go through how to resolve a collection of customized
classes.