本文整理匯總了C#中Spring.Objects.Factory.Support.DefaultListableObjectFactory.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# DefaultListableObjectFactory.Dispose方法的具體用法?C# DefaultListableObjectFactory.Dispose怎麽用?C# DefaultListableObjectFactory.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Spring.Objects.Factory.Support.DefaultListableObjectFactory
的用法示例。
在下文中一共展示了DefaultListableObjectFactory.Dispose方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: InnerObjectsInPrototype
public void InnerObjectsInPrototype()
{
DefaultListableObjectFactory xof = new DefaultListableObjectFactory();
XmlObjectDefinitionReader reader = new XmlObjectDefinitionReader(xof);
reader.LoadObjectDefinitions(new ReadOnlyXmlTestResource("reftypes.xml", GetType()));
TestObject hasInnerObjects = (TestObject) xof.GetObject("prototypeHasInnerObjects");
Assert.AreEqual(5, hasInnerObjects.Age);
Assert.IsNotNull(hasInnerObjects.Spouse);
Assert.AreEqual("inner1", hasInnerObjects.Spouse.Name);
Assert.AreEqual(6, hasInnerObjects.Spouse.Age);
Assert.IsNotNull(hasInnerObjects.Friends);
IList friends = (IList) hasInnerObjects.Friends;
Assert.AreEqual(2, friends.Count);
DerivedTestObject inner2 = (DerivedTestObject) friends[0];
Assert.AreEqual("inner2", inner2.Name);
Assert.AreEqual(7, inner2.Age);
IList friendsOfInner = (IList) inner2.Friends;
Assert.AreEqual(1, friendsOfInner.Count);
DerivedTestObject innerFriendOfAFriend = (DerivedTestObject) friendsOfInner[0];
Assert.AreEqual("innerFriendOfAFriend", innerFriendOfAFriend.Name);
Assert.AreEqual(7, innerFriendOfAFriend.Age);
TestObject innerFactory = (TestObject) friends[1];
Assert.AreEqual(DummyFactory.SINGLETON_NAME, innerFactory.Name);
Assert.IsNotNull(hasInnerObjects.SomeMap);
Assert.IsFalse((hasInnerObjects.SomeMap.Count == 0));
TestObject inner3 = (TestObject) hasInnerObjects.SomeMap["someKey"];
Assert.AreEqual("inner3", inner3.Name);
Assert.AreEqual(8, inner3.Age);
xof.Dispose();
Assert.IsFalse(inner2.WasDestroyed());
Assert.IsFalse(innerFactory.Name == null);
Assert.IsFalse(innerFriendOfAFriend.WasDestroyed());
}
示例2: InnerObjects
public void InnerObjects()
{
DefaultListableObjectFactory xof = new DefaultListableObjectFactory();
XmlObjectDefinitionReader reader = new XmlObjectDefinitionReader(xof);
reader.LoadObjectDefinitions(new ReadOnlyXmlTestResource("reftypes.xml", GetType()));
// Let's create the outer bean named "innerObject",
// to check whether it doesn't create any conflicts
// with the actual inner object named "innerObject".
xof.GetObject("innerObject");
TestObject hasInnerObjects = (TestObject) xof.GetObject("hasInnerObjects");
Assert.AreEqual(5, hasInnerObjects.Age);
TestObject inner1 = (TestObject) hasInnerObjects.Spouse;
Assert.IsNotNull(inner1);
Assert.AreEqual("Spring.Objects.TestObject#", inner1.ObjectName.Substring(0, inner1.ObjectName.IndexOf("#")+1));
Assert.AreEqual("inner1", inner1.Name);
Assert.AreEqual(6, inner1.Age);
Assert.IsNotNull(hasInnerObjects.Friends);
IList friends = (IList) hasInnerObjects.Friends;
Assert.AreEqual(2, friends.Count);
DerivedTestObject inner2 = (DerivedTestObject) friends[0];
Assert.AreEqual("inner2", inner2.Name);
Assert.AreEqual(7, inner2.Age);
Assert.AreEqual("Spring.Objects.DerivedTestObject#", inner2.ObjectName.Substring(0, inner2.ObjectName.IndexOf("#") + 1));
TestObject innerFactory = (TestObject) friends[1];
Assert.AreEqual(DummyFactory.SINGLETON_NAME, innerFactory.Name);
Assert.IsNotNull(hasInnerObjects.SomeMap);
Assert.IsFalse((hasInnerObjects.SomeMap.Count == 0));
TestObject inner3 = (TestObject) hasInnerObjects.SomeMap["someKey"];
Assert.AreEqual("Jenny", inner3.Name);
Assert.AreEqual(30, inner3.Age);
xof.Dispose();
Assert.IsTrue(inner2.WasDestroyed());
Assert.IsTrue(innerFactory.Name == null);
}