Process() public method

public Process ( ) : Castle.Facilities.BatchRegistration.ComponentDefinition[]
return Castle.Facilities.BatchRegistration.ComponentDefinition[]
		private void AddComponents(IConfiguration config)
		{
			String assemblyName = config.Attributes["name"];

			if (assemblyName == null || assemblyName.Length == 0)
			{
				String message = "The assemblyBatch node must have a 'name' attribute with the name of the assembly";

				throw new ConfigurationErrorsException(message);
			}

			ComponentScanner scanner = new ComponentScanner(assemblyName);

			ConfigureScanner(config, scanner);

			ComponentDefinition[] definitions = scanner.Process();

			foreach(ComponentDefinition definition in definitions)
			{
				if (definition.ServiceType == null)
				{
					Kernel.AddComponent( definition.Key, definition.ClassType );
				}
				else
				{
					Kernel.AddComponent( definition.Key, definition.ServiceType, definition.ClassType );
				}
			}
		}
示例#2
0
        private void AddComponents(IConfiguration config)
        {
            String assemblyName = config.Attributes["name"];

            if (assemblyName == null || assemblyName.Length == 0)
            {
                throw new ConfigurationException("The assemblyBatch node must have a 'name' " +
                                                 " attribute with the name of the assembly");
            }

            ComponentScanner scanner = new ComponentScanner(assemblyName);

            ConfigureScanner(config, scanner);

            ComponentDefinition[] definitions = scanner.Process();

            foreach (ComponentDefinition definition in definitions)
            {
                if (definition.ServiceType == null)
                {
                    Kernel.AddComponent(definition.Key, definition.ClassType);
                }
                else
                {
                    Kernel.AddComponent(definition.Key, definition.ServiceType, definition.ClassType);
                }
            }
        }