This package contains classes used to create reference decorators and managed references.
Important points
-
It provides the inversion of control design pattern but does not contain the fully functional container (you can just only create a class that will set various references).
-
Lifecycle:
-
Once the objects of a container are configured, if they implement the IReferenceable interface, they are passed a set of references for recreating links between objects in the container. If the objects implement the IOpenable interface, the open() method is called and they start to work.
-
Then, connections to various services are made, the objects start, the container starts running, and the objects carry out their tasks.
-
When the container starts to close, the objects that implement the IClosable interface are closed via their Close() method (which should make them stop working and disconnect from other services). Following this, the objects that implement the IUnreferenceable interface delete the various links between objects, and the container destroys all objects and turns off.
-
-
Build, Link, and Run - ReferenceDecorators are used during the corresponding building, linking, and running stages and are united in ManagedReferences, which are extended by ContainerReferences.
Classes
BuildReferencesDecorator
References decorator that automatically creates missing components using available component factories upon component retrival.
ContainerReferences
This class allows you to create container’s managed references that can be created from a container’s configuration..
LinkReferencesDecorator
References decorator that automatically sets references to newly added components
ManagedReferences
Managed references that in addition to keeping and locating references can also manage their lifecycle:
- Auto-creation of missing component using available factories
- Auto-linking newly added components
- Auto-opening newly added components
- Auto-closing removed components
ReferencesDecorator
Chainable decorator for IReferences that allows to inject additional capabilities such as automatic component creation, automatic registration and opening.
RunReferencesDecorator
References decorator that automatically opens to newly added components