Inject property to constructor

Jun 4, 2008 at 6:21 AM

Is it possible to inject property value of an object (singleton) into a constructor of another object (transient).
1. Resolve SINGLETON (It has property PROP of type IPROPERTY).
2. Resolve TRANSIENT (constructor accepts IPROPERTY).

So when constructing 2 (TRANSIENT object) I want to pass SINGLETON.PROPERTY to its constructor.
How can it be done?

I assume the config should look like this:

    <typeAlias alias="ISINGLETON" type="Project.ISINGLETON, Project"/>
    <typeAlias alias="IPROPERTY" type="
Project.IPROPERTY, Project"/>
    <typeAlias alias="ITRANSIENT" type="
Project.ITRANSIENT, Project"/>
            <type type="
ISINGLETON" mapTo="Project.TheSingletonImplementation, Project">
                <lifetime type="singleton" />
            <type type="ITRANSIENT" mapTo="Project.MyTransientImplementation, Project">
                <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
                        <param name="property" parameterType="IPROPERTY">
                            <value value="How to assign a value from ISINGLETON instance's property PROPERTY?"/>