/// <summary> /// Creates the message converter given its name in the application context. /// </summary> /// <param name="messageConverterObjectName">Name of the message converter object.</param> /// <returns> /// A IMessageConverter instance configured via the application context /// </returns> public IMessageConverter CreateMessageConverter(string messageConverterObjectName) { AssertUtils.ArgumentHasText(messageConverterObjectName, "MessgaeFormatterObjectName"); IDictionary converters = LogicalThreadContext.GetData(CONVERTER_DICTIONARY_SLOTNAME) as IDictionary; if (converters == null) { converters = new Hashtable(); LogicalThreadContext.SetData(CONVERTER_DICTIONARY_SLOTNAME, converters); } if (!converters.Contains(messageConverterObjectName)) { IMessageConverter mc = (IMessageConverter) applicationContext.GetObject(messageConverterObjectName, typeof(IMessageConverter)); if (applicationContext.ObjectFactory.GetObjectDefinition(messageConverterObjectName).IsSingleton) { log.Warn("MessageConverter with name = [" + messageConverterObjectName + "] should be declared with singleton=false. Using Clone() to create independent instance for thread local storage"); converters.Add(messageConverterObjectName, mc.Clone()); } else { converters.Add(messageConverterObjectName, mc); } } return(converters[messageConverterObjectName] as IMessageConverter); }