The Unity container allows creating hierarchies of child containers. This lifetime creates local singleton for each level of the hierarchy. So, when you resolve a type and this container does not have an instance of that type, the container will create new instance. Next time the type is resolved the same instance will be returned.
If a child container is created and requested to resolve the type, the child container will create a new instance and store it for subsequent resolutions. Next time the child container requests to resolve the type, it will return the stored instance.
If you have multiple children, each will resolve its own instance.
The Lifetime Manager
Hierarchical lifetime is controlled by HierarchicalLifetimeManager type. It forces each child container to resolve its own instance of the object and does not share one with the parent or child containers.
To create a Type registration with hierarchical lifetime:
or you could register a factory:
container.RegisterFactory<IService>((c, t, n) => new Service(), FactoryLifetime.Hierarchical);