Provides automatically generated factories on top of interfaces or delegates that you can use to pull components out of the container without ever referencing it explicitly.
Inheritance: Castle.MicroKernel.Facilities.AbstractFacility
コード例 #1
0
ファイル: MVCFacility.cs プロジェクト: atczyc/castle
		/// <summary>
		/// 
		/// </summary>
		protected override void Init()
		{
			if (FacilityConfig == null)
			{
				throw new ConfigurationException(
					"The MVCFacility requires an 'assembyView' child tag.");
			}

			IConfiguration factoriesConfig = FacilityConfig.Children["assembyView"];
			if (factoriesConfig!=null && 
				factoriesConfig.Value!= null && factoriesConfig.Value!= string.Empty )
			{
				_assembly =  Assembly.Load(factoriesConfig.Value) ;	
			}

			// Added TypedFactory to have a IState factory
			TypedFactoryFacility facility = new TypedFactoryFacility();

			Kernel.AddFacility("typedfactory", facility );
			facility.AddTypedFactoryEntry( new FactoryEntry("stateFactory", typeof(IStateFactory), "Create", "Release") );
			
			// Added a ControlerTree component to track controller by view
			Kernel.AddComponent( "mvc.controllerTree", typeof(ControllerTree) );
			Kernel.ComponentModelCreated += new ComponentModelDelegate(OnComponentModelCreated);

			Initialize();
		}
コード例 #2
0
		public void Init()
		{
			_container = new WindsorContainer(new DefaultConfigurationStore());
			_facility = new TypedFactoryFacility();
			_container.AddFacility("typedfactory", _facility);
		}
コード例 #3
0
		protected override void AfterContainerCreated()
		{
			facility = new TypedFactoryFacility();
			Container.AddFacility(facility);
		}
コード例 #4
0
		public void Init()
		{
			container = new WindsorContainer(new DefaultConfigurationStore());
			facility = new TypedFactoryFacility();
			container.AddFacility(facility);
		}