Castle.MonoRail.Framework.Services.DefaultControllerDescriptorProvider.CollectActions C# (CSharp) Method

CollectActions() private method

Collects the actions.
private CollectActions ( Type controllerType, ControllerMetaDescriptor desc ) : void
controllerType System.Type Type of the controller.
desc Castle.MonoRail.Framework.Internal.ControllerMetaDescriptor The desc.
return void
		private void CollectActions(Type controllerType, ControllerMetaDescriptor desc)
		{
			// HACK: GetRealControllerType is a workaround for DYNPROXY-14 bug
			// see: http://support.castleproject.org/browse/DYNPROXY-14
			controllerType = GetRealControllerType(controllerType);

			MethodInfo[] methods = controllerType.GetMethods(BindingFlags.Public | BindingFlags.Instance);

			foreach(MethodInfo method in methods)
			{
				Type declaringType = method.DeclaringType;

				if (declaringType == typeof(Object) || 
					declaringType == typeof(Controller) || 
					declaringType == typeof(SmartDispatcherController))
				{
					continue;
				}

				if (desc.Actions.Contains(method.Name))
				{
					ArrayList list = desc.Actions[method.Name] as ArrayList;

					if (list == null)
					{
						list = new ArrayList();
						list.Add(desc.Actions[method.Name]);

						desc.Actions[method.Name] = list;
					}

					list.Add(method);
				}
				else
				{
					desc.Actions[method.Name] = method;
				}
			}
		}