本文整理匯總了C#中Spring.Objects.Factory.Xml.XmlObjectFactory.GetObjectsOfType方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlObjectFactory.GetObjectsOfType方法的具體用法?C# XmlObjectFactory.GetObjectsOfType怎麽用?C# XmlObjectFactory.GetObjectsOfType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Spring.Objects.Factory.Xml.XmlObjectFactory
的用法示例。
在下文中一共展示了XmlObjectFactory.GetObjectsOfType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AbstractParentObjects
public void AbstractParentObjects()
{
XmlObjectFactory parent = new XmlObjectFactory(new ReadOnlyXmlTestResource("parent.xml", GetType()));
parent.PreInstantiateSingletons();
Assert.IsTrue(parent.IsSingleton("inheritedTestObjectWithoutClass"));
// abstract objects should not match
//TODO add overloaded GetObjectOfType with 1 arg
IDictionary tbs = parent.GetObjectsOfType(typeof(TestObject), true, true);
Assert.AreEqual(2, tbs.Count);
Assert.IsTrue(tbs.Contains("inheritedTestObjectPrototype"));
Assert.IsTrue(tbs.Contains("inheritedTestObjectSingleton"));
// non-abstract object should work, even if it serves as parent
object o1 = parent.GetObject("inheritedTestObjectPrototype");
Assert.IsTrue(o1 is TestObject);
// abstract object should return IObjectInstance itself
object o2 = parent.GetObject("inheritedTestObjectWithoutClass");
Assert.IsTrue(o2 is IObjectDefinition);
}