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


C# IApplicationContext.GetObject方法代码示例

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


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

示例1: SetUp

 public void SetUp()
 {
     applicationContext = new XmlApplicationContext("spring-config.xml");
     personRepository = (IRepository<Person>)applicationContext.GetObject("PersonRepository");
     addressRepository = (IRepository<Address>)applicationContext.GetObject("AddressRepository");
     contRepository = (IRepository<ContBancar>)applicationContext.GetObject("ContBancarRepository");
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:HibernateStartedTest.cs

示例2: RunExample

		protected override void RunExample(IApplicationContext ctx)
		{
			IFactory factory = ctx.GetObject<IFactory>("standardFactory");
			IFactory roboticFactory = ctx.GetObject<IFactory>("roboticFactory");

			BuildHouseUsing(factory);
			BuildHouseUsing(roboticFactory);
		}
开发者ID:Suremaker,项目名称:Spring.FluentContext,代码行数:8,代码来源:AdvancedPropertySetterInjectionExample.cs

示例3: ExcludeRegExpressionFilter

        public void ExcludeRegExpressionFilter()
        {
            _applicationContext = new XmlApplicationContext(ReadOnlyXmlTestResource.GetFilePath("ConfigFiles.TypeScannerTestRegExExclude.xml", GetType()));

            Assert.That(_applicationContext.GetObjectDefinitionNames().Count, Is.EqualTo(8));
            Assert.That(_applicationContext.GetObject("SomeIncludeType1"), Is.Not.Null);
            Assert.That(delegate { _applicationContext.GetObject("SomeExcludeType"); }, Throws.Exception.TypeOf<NoSuchObjectDefinitionException>());
        }
开发者ID:spring-projects,项目名称:spring-net-codeconfig,代码行数:8,代码来源:ComponentScanObjectDefinitionParserTypeFilterTests.cs

示例4: RunExample

		protected override void RunExample(IApplicationContext ctx)
		{
			var sender = ctx.GetObject<Sender>();
			sender.Run();
			//to let background tasks to finish
			Thread.Sleep(3000);
		}
开发者ID:Suremaker,项目名称:Spring.FluentContext,代码行数:7,代码来源:ComplexExample.cs

示例5: Run

        /// <summary>
        /// Loads the application
        /// </summary>
        public void Run()
        {
            _logger.Log("Creating Unity container", Category.Debug, Priority.Low);
            _container = CreateContainer();

            if (Container == null)
            {
                throw new InvalidOperationException(Properties.Resources.NullContainerException);
            }

            _logger.Log("Configuring container", Category.Debug, Priority.Low);

            ConfigureContainer();

            _logger.Log("Configuring region adapters", Category.Debug, Priority.Low);

            ConfigureRegionAdapterMappings();

            _logger.Log("Creating shell", Category.Debug, Priority.Low);
            DependencyObject shell = CreateShell();

            if (shell != null)
            {
                RegionManager.SetRegionManager(shell, (IRegionManager)_container.GetObject("IRegionManager"));
            }

            _logger.Log("Initializing modules", Category.Debug, Priority.Low);
            InitializeModules();

            _logger.Log("Bootstrapper sequence completed", Category.Debug, Priority.Low);
        }
开发者ID:jfromaniello,项目名称:prismcontrib,代码行数:34,代码来源:SpringBootstrapper.cs

示例6: TestFixtureSetUp

        public virtual void TestFixtureSetUp()
        {
            _context = new XmlApplicationContext(ConfigFiles);
            _bus = _context.GetObject("IEventBus") as IEventBus;

            //Hack so that we don't have to validate the Anubis server certificate.
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:8,代码来源:GtsAnubisAndTwoWaySSLforRabbit.cs

示例7: TestFixtureSetUp

        public virtual void TestFixtureSetUp()
        {
            _context = new XmlApplicationContext(Config.Authorization.AnubisTwoWaySsl, Config.Topology.GtsSSL);
            _factory = _context.GetObject("IRabbitConnectionFactory") as TokenConnectionFactory;

            //Hack so that we don't have to validate the Anubis server certificate.
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:8,代码来源:TokenConnectionFactoryTests.cs

示例8: RunExample

		protected override void RunExample(IApplicationContext ctx)
		{
			IFarm cowFarm = ctx.GetObject<IFarm>("cowFarm");
			IFarm pigFarm = ctx.GetObject<IFarm>("pigFarm");

			Console.WriteLine("\nRunning cow farm");
			cowFarm.RunFarm();

			Console.WriteLine("\nRunning pig farm");
			pigFarm.RunFarm();

			Console.WriteLine("\nRunning cow farm for second time");
			cowFarm.RunFarm();

			Console.WriteLine("\nRunning pig farm for second time");
			pigFarm.RunFarm();
		}
开发者ID:Suremaker,项目名称:Spring.FluentContext,代码行数:17,代码来源:AdvancedLookupMethodInjectionExample.cs

示例9: TestBuscarUsuario

 private static void TestBuscarUsuario(IApplicationContext ctx)
 {
     IUsuarioService us = (IUsuarioService) ctx.GetObject("usuarioService");
     Usuario usuario = new Usuario();
     usuario.Nombre = "poligarcia";
     IList res = us.BuscarUsuarios(usuario);
     usuario = (Usuario) res[0];
     Console.WriteLine(usuario.Id);
 }
开发者ID:BGCX261,项目名称:zonica-svn-to-git,代码行数:9,代码来源:SpringTest.cs

示例10: TraspasaDocumentos

        public void TraspasaDocumentos()
        {
            List<IOperacion> lstsrvmiddle = null;
            int nRt = 0;
            ILog oLog = null;
            string sAux = string.Empty;

            EventLog ELog = new EventLog("Application", ".", _sSourceEvLog);
            String sBasePath = System.AppDomain.CurrentDomain.BaseDirectory;
            try
            {
                oLog = new ooLogSrv();
                ELog.WriteEntry(string.Format("Antes de config spring, base path: {0}", sBasePath));

                    try
                    {
                        _appContext = new XmlApplicationContext(Path.Combine(sBasePath, "di.config.xml"));
                    }
                    catch (Exception ex)
                    {
                        oLog.LogException(ex);
                    }
                    ELog.WriteEntry(string.Format("Despues de config spring"));
                    lstsrvmiddle = (List<IOperacion>)_appContext.GetObject("pluginComponentesTraspasoDoc");
                    oLog.LogInfo(string.Format("Application started at  {0}", DateTime.Now));
                    nRt = 0;

                    ELog.WriteEntry(string.Format("Application started at '{0}'", DateTime.Now));

                    try
                    {
                        foreach (IOperacion srvOp in lstsrvmiddle)
                        {
                            srvOp.oLog = oLog;
                            nRt = srvOp.lTraspasar();
                            oLog.LogInfo(string.Format("Application finish procesing of '{0}' registers of  type {1} at '{2}'", nRt, srvOp.GetType().Name, DateTime.Now));
                        }
                    }
                    catch (Exception ex)
                    {
                        oLog.LogException(ex);
                    }

            }
            catch (Exception ex)
            {
                ELog.WriteEntry(string.Format("Excepcion: {0}", ex));
                oLog.LogException(ex);
            }
            finally
            {
                oLog.LogInfo(string.Format("Servicio finaliza ejecucion a las '{0}'", DateTime.Now));
                Thread.CurrentThread.Abort(); //se finaliza el thread
            }
        }
开发者ID:aleloyola,项目名称:srvFEmiddle,代码行数:55,代码来源:srvFEmiddle.cs

示例11: RunExample

		protected override void RunExample(IApplicationContext ctx)
		{
			var factory = ctx.GetObject<Factory>();
			factory.Create("Car");
			factory.Create("Motorcycle");
			factory.Create("Luxury Car");

			var shopsInContext = ctx.GetObjectsOfType(typeof(Shop)).Values.OfType<Shop>().Select(s => s.ToString()).ToArray();
			Console.WriteLine("Shops available in context: {0}", string.Join(",", shopsInContext));
			Console.WriteLine("Done...");
		}
开发者ID:Suremaker,项目名称:Spring.FluentContext,代码行数:11,代码来源:CollectionInjectionExample.cs

示例12: TestAlbumesMasEscuchados

        private static void TestAlbumesMasEscuchados(IApplicationContext ctx)
        {
            ISessionFactory sf = (ISessionFactory) ctx.GetObject("sessionFactory");
            ISession s = sf.OpenSession();

            IQuery q = s.GetNamedQuery("albumesMasEscuchados");
            IList artistas = q.List();
            foreach (ItemRanking a in artistas) {
                Console.WriteLine("{0}.- {1}", a.Id, a.Nombre);
            }
        }
开发者ID:BGCX261,项目名称:zonica-svn-to-git,代码行数:11,代码来源:SpringTest.cs

示例13: TestArtistaAlbum

        private static void TestArtistaAlbum(IApplicationContext ctx)
        {
            ISessionFactory sf = (ISessionFactory) ctx.GetObject("sessionFactory");
            ISession s = sf.OpenSession();

            IList artistas = s.CreateCriteria(typeof (Artista)).List();
            foreach (Artista a in artistas) {
                Console.WriteLine("{0}.- {1}", a.Id, a.Nombre);
                foreach (Album al in a.Albumes) {
                    Console.WriteLine(" + {0}.- ({1}) {2}", al.Id, al.AnioPublicacion, al.Nombre);
                }
            }
        }
开发者ID:BGCX261,项目名称:zonica-svn-to-git,代码行数:13,代码来源:SpringTest.cs

示例14: TestController

 public TestController(IApplicationContext ctx)
 {
     _ctx = ctx;
     _resourceManager = (IResourceManager)ctx.GetObject("ResourceManager");
     _resourceManager.SetTestController(this);
     _testCases = new BindingList<TestCase>();
     _communicationManager = new CommunicatorManager();
     _robotRepo = new RobotsRepository();
     _clientThreadPool = new AgentThreadPool();
     _focusedAgent = null;
     _focusedTestCase = null;
     _refreshFocusViewLock = new Object();
     _driverList = new List<IRobotDriver>();
     _mapManager = new MapManager();
 }
开发者ID:marmur,项目名称:jm_mrs,代码行数:15,代码来源:TestController.cs

示例15: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _bus = _rpcBus = _context.GetObject("IRpcEventBus") as IRpcEventBus;

            _backendContext = new XmlApplicationContext(ConfigFiles);
            _backendBus = _backendContext.GetObject("IRpcEventBus") as IRpcEventBus;

            _backendBus.Subscribe<TestRequest>(
                (@event, headers) =>
                    {
                        for (int i = 0; i < @event.ResponseCount; i++)
                            _backendBus.RespondTo(headers, new TestResponse { Id = @event.Id });

                    },
                env => true);
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:17,代码来源:DefaultRpcBusTests.cs


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