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


C# XmlApplicationContext.Refresh方法代码示例

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


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

示例1: CanBeUsedToReconfigureAnApplicationContextOnRefresh

        public void CanBeUsedToReconfigureAnApplicationContextOnRefresh()
        {
            MockObjectFactoryPostProcessor mofp = new MockObjectFactoryPostProcessor();

            IConfigurableApplicationContext ctx = new XmlApplicationContext(false, "name", false, null);
            ctx.AddObjectFactoryPostProcessor(new DelegateObjectFactoryConfigurer(of => of.RegisterSingleton("mofp", mofp)));

            ctx.Refresh();

            mofp.Called = false;
            ctx.Refresh();
            Assert.IsTrue(mofp.Called);
        }
开发者ID:fgq841103,项目名称:spring-net,代码行数:13,代码来源:DelegateObjectFactoryConfigurerTests.cs

示例2: ExecutesBeforeObjectFactoryPostProcessing

        public void ExecutesBeforeObjectFactoryPostProcessing()
        {
            MockObjectFactoryPostProcessor mofp = new MockObjectFactoryPostProcessor();

            IConfigurableApplicationContext ctx = new XmlApplicationContext(false, "name", false, null);
            ctx.AddObjectFactoryPostProcessor(new DelegateObjectFactoryConfigurer(delegate(IConfigurableListableObjectFactory of)
                                                                                        {
                                                                                            of.RegisterSingleton("mofp", mofp);
                                                                                        }));

            ctx.Refresh();
            Assert.IsTrue(mofp.Called);
        }
开发者ID:Binodesk,项目名称:spring-net,代码行数:13,代码来源:DelegateObjectFactoryConfigurerTests.cs

示例3: MultipleConfigLocations

 public void MultipleConfigLocations()
 {
     XmlApplicationContext ctx =
         new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/contextB.xml",
                                   "assembly://Spring.Core.Tests/Spring.Context.Support/contextC.xml",
                                   "assembly://Spring.Core.Tests/Spring.Context.Support/contextA.xml");
     Assert.IsTrue(ctx.ContainsObject("service"));
     Assert.IsTrue(ctx.ContainsObject("logicOne"));
     Assert.IsTrue(ctx.ContainsObject("logicTwo"));
     Service service = (Service) ctx.GetObject("service");
     ctx.Refresh();
     Assert.IsTrue(service.ProperlyDestroyed);
     service = (Service) ctx.GetObject("service");
     ctx.Dispose();
     Assert.IsTrue(service.ProperlyDestroyed);
 }
开发者ID:spring-projects,项目名称:spring-net,代码行数:16,代码来源:XmlApplicationContextTests.cs

示例4: ShouldLoad

        public void ShouldLoad()
        {
            IList<IObjectFactoryPostProcessor> all = new List<IObjectFactoryPostProcessor>();

            XmlApplicationContext child1 = new XmlApplicationContext("file://Spring/Layered/child1.xml");
            IDictionary processors = child1.GetObjectsOfType(typeof (IObjectFactoryPostProcessor));
            IEnumerator enumerator = processors.Values.GetEnumerator();

            while(enumerator.MoveNext())
            {
                all.Add((IObjectFactoryPostProcessor)enumerator.Current);
            }

            XmlApplicationContext child2 = new XmlApplicationContext(false, null, true, child1, "file://Spring/Layered/child2.xml");
            foreach (IObjectFactoryPostProcessor entry in all)
            {
                child2.AddObjectFactoryPostProcessor(entry);
            }
            child2.Refresh();
            XmlApplicationContext main = new XmlApplicationContext(false, null, true, child2, "file://Spring/Layered/main.xml");

            foreach (IObjectFactoryPostProcessor entry in all)
            {
                main.AddObjectFactoryPostProcessor(entry);
            }
            main.Refresh();
            Aggregate agg = (Aggregate) main.GetObject("agg");
            Assert.IsNotNull(agg);

            Service3 three = (Service3) main.GetObject("service3");

            Assert.IsNotNull(three);

            PostProcessor processor = (PostProcessor)main.GetObject("PostProcessor");

            Assert.IsNotNull(processor);
            IList<string> names = processor.Names;
            Assert.AreEqual(3, names.Count);
            Assert.IsTrue(names.Contains("foo"));
            Assert.IsTrue(names.Contains("barService"));
            Assert.IsTrue(names.Contains("connection"));
        }
开发者ID:sbendiola,项目名称:sandbox,代码行数:42,代码来源:TestLayering.cs


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