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


C# XmlApplicationContext.Dispose方法代碼示例

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


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

示例1: Main

 public void Main()
 {
     var ctx = new XmlApplicationContext("objects.xml");
     var o1 = ctx.GetObject("SingletonObject");
     var o2 = ctx.GetObject("ProtoTypeObject");
     ctx.Dispose();
 }
開發者ID:serra,項目名稱:stackoverflow,代碼行數:7,代碼來源:Program.cs

示例2: 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

示例3: SingleConfigLocation

 public void SingleConfigLocation()
 {
     XmlApplicationContext ctx =
         new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/simpleContext.xml");
     Assert.IsTrue(ctx.ContainsObject("someMessageSource"));
     ctx.Dispose();
 }
開發者ID:spring-projects,項目名稱:spring-net,代碼行數:7,代碼來源:XmlApplicationContextTests.cs

示例4: TestWithTwoAnonymousMethodInvokingJobDetailFactoryObjects

        public void TestWithTwoAnonymousMethodInvokingJobDetailFactoryObjects()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("multipleAnonymousMethodInvokingJobDetailFB.xml");
            Thread.Sleep(3000);
            try
            {
                QuartzTestObject exportService = (QuartzTestObject) ctx.GetObject("exportService");
                QuartzTestObject importService = (QuartzTestObject) ctx.GetObject("importService");

                Assert.AreEqual(0, exportService.ImportCount, "doImport called exportService");
                Assert.AreEqual(2, exportService.ExportCount, "doExport not called on exportService");
                Assert.AreEqual(2, importService.ImportCount, "doImport not called on importService");
                Assert.AreEqual(0, importService.ExportCount, "doExport called on importService");
            }
            finally
            {
                ctx.Dispose();
            }
        }
開發者ID:smnbss,項目名稱:spring-net,代碼行數:19,代碼來源:QuartzSupportTests.cs

示例5: TestSchedulerRepositoryExposure

 public void TestSchedulerRepositoryExposure()
 {
     XmlApplicationContext ctx = new XmlApplicationContext("schedulerRepositoryExposure.xml");
     Assert.AreSame(SchedulerRepository.Instance.Lookup("myScheduler"), ctx.GetObject("scheduler"));
     ctx.Dispose();
 }
開發者ID:smnbss,項目名稱:spring-net,代碼行數:6,代碼來源:QuartzSupportTests.cs

示例6: TestSchedulerAccessorObject

        public void TestSchedulerAccessorObject()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("schedulerAccessorObject.xml");
            Thread.Sleep(3000);
            try
            {
                QuartzTestObject exportService = (QuartzTestObject) ctx.GetObject("exportService");
                QuartzTestObject importService = (QuartzTestObject) ctx.GetObject("importService");

                Assert.AreEqual(0, exportService.ImportCount, "doImport called exportService");
                Assert.AreEqual(2, exportService.ExportCount, "doExport not called on exportService");
                Assert.AreEqual(2, importService.ImportCount, "doImport not called on importService");
                Assert.AreEqual(0, importService.ExportCount, "doExport called on importService");
            }
            finally
            {
                ctx.Dispose();
            }
        }
開發者ID:smnbss,項目名稱:spring-net,代碼行數:19,代碼來源:QuartzSupportTests.cs

示例7: TestMultipleSchedulers

        public void TestMultipleSchedulers()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("multipleSchedulers.xml");
            try
            {
                IScheduler scheduler1 = (IScheduler) ctx.GetObject("scheduler1");
                IScheduler scheduler2 = (IScheduler) ctx.GetObject("scheduler2");
                Assert.AreNotSame(scheduler1, scheduler2);
                Assert.AreEqual("quartz1", scheduler1.SchedulerName);
                Assert.AreEqual("quartz2", scheduler2.SchedulerName);

                XmlApplicationContext ctx2 = new XmlApplicationContext("multipleSchedulers.xml");
                try
                {
                    IScheduler scheduler1a = (IScheduler) ctx2.GetObject("scheduler1");
                    IScheduler scheduler2a = (IScheduler) ctx2.GetObject("scheduler2");
                    Assert.AreNotSame(scheduler1a, scheduler2a);
                    Assert.AreNotSame(scheduler1a, scheduler1);
                    Assert.AreNotSame(scheduler2a, scheduler2);
                    Assert.AreEqual("quartz1", scheduler1a.SchedulerName);
                    Assert.AreEqual("quartz2", scheduler2a.SchedulerName);
                }
                finally
                {
                    ctx2.Dispose();
                }
            }
            finally
            {
                ctx.Dispose();
            }
        }
開發者ID:smnbss,項目名稱:spring-net,代碼行數:32,代碼來源:QuartzSupportTests.cs


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