本文整理汇总了C#中IApplicationContext.ContainsObjectDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationContext.ContainsObjectDefinition方法的具体用法?C# IApplicationContext.ContainsObjectDefinition怎么用?C# IApplicationContext.ContainsObjectDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplicationContext
的用法示例。
在下文中一共展示了IApplicationContext.ContainsObjectDefinition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterDefaultMessageConverter
/// <summary>
/// Registers the default message converter with the application context.
/// </summary>
/// <param name="applicationContext">The application context.</param>
/// <returns>The name of the message converter to use for lookups with
/// <see cref="DefaultMessageQueueFactory"/>.
/// </returns>
public static string RegisterDefaultMessageConverter(IApplicationContext applicationContext)
{
//Create a default message converter to use.
RootObjectDefinition rod = new RootObjectDefinition(typeof(XmlMessageConverter));
rod.PropertyValues.Add("TargetTypes", new Type[] { typeof(String) });
rod.IsSingleton = false;
IConfigurableApplicationContext ctx = (IConfigurableApplicationContext)applicationContext;
DefaultListableObjectFactory of = (DefaultListableObjectFactory)ctx.ObjectFactory;
string messageConverterObjectName = "__XmlMessageConverter__";
if (!applicationContext.ContainsObjectDefinition(messageConverterObjectName))
{
of.RegisterObjectDefinition(messageConverterObjectName, rod);
}
return messageConverterObjectName;
}