当前位置: 首页>>代码示例>>C#>>正文


C# DefaultListableObjectFactory.AutowireObjectProperties方法代码示例

本文整理汇总了C#中Spring.Objects.Factory.Support.DefaultListableObjectFactory.AutowireObjectProperties方法的典型用法代码示例。如果您正苦于以下问题:C# DefaultListableObjectFactory.AutowireObjectProperties方法的具体用法?C# DefaultListableObjectFactory.AutowireObjectProperties怎么用?C# DefaultListableObjectFactory.AutowireObjectProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spring.Objects.Factory.Support.DefaultListableObjectFactory的用法示例。


在下文中一共展示了DefaultListableObjectFactory.AutowireObjectProperties方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AutowireExistingObjectByTypeWithDependencyCheck

 public void AutowireExistingObjectByTypeWithDependencyCheck()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     DependenciesObject existingObj = new DependenciesObject();
     lof.AutowireObjectProperties(existingObj, AutoWiringMode.ByType, true);
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:6,代码来源:DefaultListableObjectFactoryTests.cs

示例2: AutowireExistingObjectByTypeWithNoDependencyCheck

 public void AutowireExistingObjectByTypeWithNoDependencyCheck()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     DependenciesObject existingObj = new DependenciesObject();
     lof.AutowireObjectProperties(existingObj, AutoWiringMode.ByType, false);
     Assert.IsNull(existingObj.Spouse);
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:7,代码来源:DefaultListableObjectFactoryTests.cs

示例3: AutowireExistingObjectByType

 public void AutowireExistingObjectByType()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     RootObjectDefinition rod = new RootObjectDefinition(typeof(TestObject));
     lof.RegisterObjectDefinition("test", rod);
     DependenciesObject existingObj = new DependenciesObject();
     lof.AutowireObjectProperties(existingObj, AutoWiringMode.ByType, true);
     TestObject test = (TestObject)lof.GetObject("test");
     Assert.AreEqual(existingObj.Spouse, test);
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:10,代码来源:DefaultListableObjectFactoryTests.cs

示例4: AutowireByTypeWithInvalidAutowireMode

 public void AutowireByTypeWithInvalidAutowireMode()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     DependenciesObject obj = new DependenciesObject();
     lof.AutowireObjectProperties(obj, AutoWiringMode.Constructor, true);
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:6,代码来源:DefaultListableObjectFactoryTests.cs

示例5: AutowireExistingObjectByNameWithNoDependencyCheck

 public void AutowireExistingObjectByNameWithNoDependencyCheck()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     RootObjectDefinition rod = new RootObjectDefinition(typeof(TestObject));
     lof.RegisterObjectDefinition("Spous", rod);
     DependenciesObject existingObj = new DependenciesObject();
     lof.AutowireObjectProperties(existingObj, AutoWiringMode.ByName, false);
     Assert.IsNull(existingObj.Spouse);
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:9,代码来源:DefaultListableObjectFactoryTests.cs

示例6: AutowireExistingObjectByNameWithDependencyCheck

 public void AutowireExistingObjectByNameWithDependencyCheck()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     RootObjectDefinition rod = new RootObjectDefinition(typeof(TestObject));
     lof.RegisterObjectDefinition("Spous", rod);
     DependenciesObject existingObj = new DependenciesObject();
     lof.AutowireObjectProperties(existingObj, AutoWiringMode.ByName, true);
     Assert.Fail("Should have thrown UnsatisfiedDependencyException");
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:9,代码来源:DefaultListableObjectFactoryTests.cs

示例7: AutowireExistingObjectByName

 public void AutowireExistingObjectByName()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     RootObjectDefinition rod = new RootObjectDefinition(typeof(TestObject));
     lof.RegisterObjectDefinition("Spouse", rod);
     DependenciesObject existingObj = new DependenciesObject();
     lof.AutowireObjectProperties(existingObj, AutoWiringMode.ByName, true);
     TestObject spouse = (TestObject)lof.GetObject("Spouse");
     Assert.AreEqual(existingObj.Spouse, spouse);
     Assert.IsTrue(ObjectFactoryUtils.ObjectOfType(lof, typeof(TestObject)) == spouse);
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:11,代码来源:DefaultListableObjectFactoryTests.cs

示例8: AutowireExistingObjectByTypeWithDependencyCheck

 public void AutowireExistingObjectByTypeWithDependencyCheck()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     DependenciesObject existingObj = new DependenciesObject();
     Assert.Throws<UnsatisfiedDependencyException>(() => lof.AutowireObjectProperties(existingObj, AutoWiringMode.ByType, true));
 }
开发者ID:spring-projects,项目名称:spring-net,代码行数:6,代码来源:DefaultListableObjectFactoryTests.cs

示例9: AutowireByTypeWithInvalidAutowireMode

 public void AutowireByTypeWithInvalidAutowireMode()
 {
     DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
     DependenciesObject obj = new DependenciesObject();
     Assert.Throws<ArgumentException>(() => lof.AutowireObjectProperties(obj, AutoWiringMode.Constructor, true));
 }
开发者ID:spring-projects,项目名称:spring-net,代码行数:6,代码来源:DefaultListableObjectFactoryTests.cs


注:本文中的Spring.Objects.Factory.Support.DefaultListableObjectFactory.AutowireObjectProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。