Multiple invocations on one injection method?

Jul 24, 2008 at 10:11 PM
Edited Jul 24, 2008 at 10:29 PM
It seems that Unity doesn't support definition of Collection type, such as Hashtable or List.
So I tried to use the injection method as a workaround like this:
        internal Hashtable m_applicationProperties = new Hashtable();
        public void addProperty(string p_key, string p_value)
            m_applicationProperties.Add(p_key, p_value);
and then configure multiple invocation on addProperty method in app.config file like following:
              <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,
                <method name="addProperty">
                  <param name="p_key" parameterType="string">
                    <value value="defaultLanguageId"/>
                  <param name="p_value" parameterType="string">
                    <value value="1"/>
                <method name="addProperty">
                  <param name="p_key" parameterType="string">
                    <value value="systemLockTimeout"/>
                  <param name="p_value" parameterType="string">
                    <value value="360000"/>
But at runtime, it seemed that only the last injection method got invoked.
Is this a bug or some sort of restriction? I didn't see it in the help documentation.
Thank you.

Jul 24, 2008 at 11:23 PM
Edited Jul 24, 2008 at 11:23 PM
This issue is already tracked in
Hopefully we will have some practical solution in next drop.
Jul 24, 2008 at 11:25 PM
Configuring multiple calls to the same method just overwrites the previous configuration; it won't cause multiple calls to happen.

We're looking at how to do better collection support for the next release.

Jul 25, 2008 at 4:40 PM
Happy to know that, thanks Chris.