"how do I get my Unit object out of the container into a concrete form?"
You mean how do you obtain an instance ofa Unit object? You can get an instance of Unit object by resolving it from the container:
IUnit unit = cnt.Resolve<IUnit>();
Use the interface type, not the actual implementation.
Anyway, if you want to inject a dependency to your Manager class, you can make IUnit a parameter in its constructor and register the Manager class in the config as well with constructor injection. Assuming the Manager is in a project called Business
with the constructor below:
public Manager(IUnit unit)
the registration for the Manager class should look like:
<register type="Business.Manager, Business" />
<param name="unit" dependencyType="IUnit" />
and then when you resolve for the Manager class,
Manager manager = cnt.Resolve<Manager>();
it will automatically be created by Unity passing an instance of IUnit as defined in your IUnit registration. Note that you can also opt not to make IUnit a parameter in the constructor; you can make it a public property as well and configure property
injection for it. This is included in the documentation so you can check it out.
Does this answer your question?
Global Technologies and Solutions