本文整理匯總了C#中Spring.Context.Support.XmlApplicationContext.ContainsObject方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlApplicationContext.ContainsObject方法的具體用法?C# XmlApplicationContext.ContainsObject怎麽用?C# XmlApplicationContext.ContainsObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Spring.Context.Support.XmlApplicationContext
的用法示例。
在下文中一共展示了XmlApplicationContext.ContainsObject方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MultipleConfigLocations
public void MultipleConfigLocations()
{
XmlApplicationContext ctx =
new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/contextB.xml",
"assembly://Spring.Core.Tests/Spring.Context.Support/contextC.xml",
"assembly://Spring.Core.Tests/Spring.Context.Support/contextA.xml");
Assert.IsTrue(ctx.ContainsObject("service"));
Assert.IsTrue(ctx.ContainsObject("logicOne"));
Assert.IsTrue(ctx.ContainsObject("logicTwo"));
Service service = (Service) ctx.GetObject("service");
ctx.Refresh();
Assert.IsTrue(service.ProperlyDestroyed);
service = (Service) ctx.GetObject("service");
ctx.Dispose();
Assert.IsTrue(service.ProperlyDestroyed);
}
示例2: SingleConfigLocation
public void SingleConfigLocation()
{
XmlApplicationContext ctx =
new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/simpleContext.xml");
Assert.IsTrue(ctx.ContainsObject("someMessageSource"));
ctx.Dispose();
}
示例3: ContextWithPostProcessors
public void ContextWithPostProcessors()
{
CountingObjectPostProcessor.Count = 0;
CoutingObjectFactoryPostProcessor.Count = 0;
IApplicationContext ctx =
new XmlApplicationContext("assembly://Spring.Core.Tests/Spring.Context.Support/objects.xml");
Assert.IsTrue(ctx.ContainsObject("abstractObjectProcessorPrototype"));
Assert.IsTrue(ctx.ContainsObject("abstractFactoryProcessorPrototype"));
Assert.AreEqual(0, CountingObjectPostProcessor.Count);
Assert.AreEqual(0, CoutingObjectFactoryPostProcessor.Count);
}
示例4: GetObjectOnUnknownIdThrowsNoSuchObjectDefinition
public void GetObjectOnUnknownIdThrowsNoSuchObjectDefinition()
{
XmlApplicationContext ctx =
new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/objects.xml");
string DOES_NOT_EXIST = "does_not_exist";
Assert.IsFalse(ctx.ContainsObject(DOES_NOT_EXIST));
Assert.Throws<NoSuchObjectDefinitionException>(() => ctx.GetObject(DOES_NOT_EXIST));
}
示例5: CaseInsensitiveContext
public void CaseInsensitiveContext()
{
XmlApplicationContext ctx =
new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/objects.xml");
Assert.IsTrue(ctx.ContainsObject("goran"));
Assert.IsTrue(ctx.ContainsObject("Goran"));
Assert.IsTrue(ctx.ContainsObject("GORAN"));
Assert.AreEqual(ctx.GetObject("goran"), ctx.GetObject("GORAN"));
}
示例6: ContextWithInvalidLazyType
public void ContextWithInvalidLazyType()
{
XmlApplicationContext ctx =
new XmlApplicationContext(false,
"assembly://Spring.Core.Tests/Spring.Context.Support/invalidType.xml");
Assert.IsTrue(ctx.ContainsObject("someMessageSource"));
ctx.GetObject("someMessageSource");
}