當前位置: 首頁>>代碼示例>>C#>>正文


C# DefaultListableObjectFactory.ConfigureObject方法代碼示例

本文整理匯總了C#中Spring.Objects.Factory.Support.DefaultListableObjectFactory.ConfigureObject方法的典型用法代碼示例。如果您正苦於以下問題:C# DefaultListableObjectFactory.ConfigureObject方法的具體用法?C# DefaultListableObjectFactory.ConfigureObject怎麽用?C# DefaultListableObjectFactory.ConfigureObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Spring.Objects.Factory.Support.DefaultListableObjectFactory的用法示例。


在下文中一共展示了DefaultListableObjectFactory.ConfigureObject方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ConfigureObjectDoesNotApplyObjectPostProcessorsIfNoDefinition

        public void ConfigureObjectDoesNotApplyObjectPostProcessorsIfNoDefinition()
        {
            DefaultListableObjectFactory of = new DefaultListableObjectFactory();
            object wrapperObject = "WrapperObject";
            of.AddObjectPostProcessor( new TestObjectPostProcessor(wrapperObject));
 
            object testObject = "TestObject";
            object resultObject = of.ConfigureObject(testObject, "non-existant definition");
            Assert.AreSame(testObject, resultObject);            
        }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:10,代碼來源:DefaultListableObjectFactoryTests.cs

示例2: ConfigureObjectReturnsOriginalInstanceIfNoDefinitionFound

 public void ConfigureObjectReturnsOriginalInstanceIfNoDefinitionFound()
 {
     IConfigurableObjectFactory of = new DefaultListableObjectFactory();
     object testObject = new object();
     object resultObject = of.ConfigureObject(testObject, "non-existing object definition name");
     Assert.AreSame(testObject, resultObject);
 }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:7,代碼來源:DefaultListableObjectFactoryTests.cs

示例3: ConfigureObjectAppliesObjectPostProcessorsUsingDefinition

        public void ConfigureObjectAppliesObjectPostProcessorsUsingDefinition()
        {
            DefaultListableObjectFactory of = new DefaultListableObjectFactory();
            object wrapperObject = "WrapperObject";
            of.AddObjectPostProcessor( new TestObjectPostProcessor(wrapperObject));
            of.RegisterObjectDefinition("myObjectDefinition", new RootObjectDefinition());

            object testObject = "TestObject";
            object resultObject = of.ConfigureObject(testObject, "myObjectDefinition");
            Assert.AreSame(wrapperObject, resultObject);            
        }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:11,代碼來源:DefaultListableObjectFactoryTests.cs

示例4: ConfigureObjectViaLoadOfOldWhitespaceName

 public void ConfigureObjectViaLoadOfOldWhitespaceName()
 {
     TestObject instance = new TestObject();
     DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
     fac.ConfigureObject(instance, "        \t");
 }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:6,代碼來源:DefaultListableObjectFactoryTests.cs

示例5: ConfigureObjectViaEmptyName

 public void ConfigureObjectViaEmptyName()
 {
     TestObject instance = new TestObject();
     DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
     fac.ConfigureObject(instance, string.Empty);
 }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:6,代碼來源:DefaultListableObjectFactoryTests.cs

示例6: ConfigureObjectViaNullName

 public void ConfigureObjectViaNullName()
 {
     TestObject instance = new TestObject();
     DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
     fac.ConfigureObject(instance, null);
 }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:6,代碼來源:DefaultListableObjectFactoryTests.cs

示例7: ConfigureObjectViaExplicitName

 public void ConfigureObjectViaExplicitName()
 {
     TestObject instance = new TestObject();
     RootObjectDefinition everyman = new RootObjectDefinition();
     everyman.IsAbstract = true;
     everyman.PropertyValues = new MutablePropertyValues();
     everyman.PropertyValues.Add("name", "Noone");
     everyman.PropertyValues.Add("age", 9781);
     DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
     fac.RegisterObjectDefinition("everyman", everyman);
     fac.ConfigureObject(instance, "everyman");
     Assert.AreEqual(true, instance.InitCompleted, "AfterPropertiesSet() was not invoked by IObjectFactory.ConfigureObject(instance).");
     Assert.AreEqual("Noone", instance.Name, "Name dependency injected via IObjectFactory.ConfigureObject(instance) failed (was null).");
     Assert.AreEqual(9781, instance.Age, "Age dependency injected via IObjectFactory.ConfigureObject(instance) failed (was null).");
 }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:15,代碼來源:DefaultListableObjectFactoryTests.cs

示例8: ConfigureObject

 public void ConfigureObject()
 {
     TestObject instance = new TestObject();
     RootObjectDefinition everyman = new RootObjectDefinition();
     everyman.IsAbstract = true;
     everyman.PropertyValues = new MutablePropertyValues();
     everyman.PropertyValues.Add("name", "Noone");
     everyman.PropertyValues.Add("age", 9781);
     DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
     fac.RegisterObjectDefinition(instance.GetType().FullName, everyman);
     fac.ConfigureObject(instance, instance.GetType().FullName);
     Assert.AreEqual("Noone", instance.Name, "Name dependency injected via IObjectFactory.ConfigureObject(instance) failed (was null).");
     Assert.AreEqual(9781, instance.Age, "Age dependency injected via IObjectFactory.ConfigureObject(instance) failed (was null).");
 }
開發者ID:ouyangyl,項目名稱:MySpringNet,代碼行數:14,代碼來源:DefaultListableObjectFactoryTests.cs

示例9: ConfigureObjectViaEmptyName

 public void ConfigureObjectViaEmptyName()
 {
     TestObject instance = new TestObject();
     DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
     Assert.Throws<ArgumentException>(() => fac.ConfigureObject(instance, string.Empty));
 }
開發者ID:spring-projects,項目名稱:spring-net,代碼行數:6,代碼來源:DefaultListableObjectFactoryTests.cs

示例10: ConfigureObjectViaLoadOfOldWhitespaceName

 public void ConfigureObjectViaLoadOfOldWhitespaceName()
 {
     TestObject instance = new TestObject();
     DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
     Assert.Throws<ArgumentException>(() => fac.ConfigureObject(instance, "        \t"));
 }
開發者ID:spring-projects,項目名稱:spring-net,代碼行數:6,代碼來源:DefaultListableObjectFactoryTests.cs


注:本文中的Spring.Objects.Factory.Support.DefaultListableObjectFactory.ConfigureObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。