当前位置: 首页>>代码示例>>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;未经允许,请勿转载。