本文整理汇总了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);
}