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

GetRealControllerType() private method

Gets the real controller type, instead of the proxy type.
Workaround for DYNPROXY-14 bug. See: http://support.castleproject.org/browse/DYNPROXY-14
private GetRealControllerType ( Type controllerType ) : Type
controllerType System.Type
return System.Type
		private Type GetRealControllerType(Type controllerType)
		{
			Type prev = controllerType;

			// try to get the first non-proxy type
			while(controllerType.Assembly.FullName.StartsWith("DynamicProxyGenAssembly2") || 
				  controllerType.Assembly.FullName.StartsWith("DynamicAssemblyProxyGen"))
			{
				controllerType = controllerType.BaseType;

				if (controllerType == typeof(SmartDispatcherController) || 
				    controllerType == typeof(Controller))
				{
					// oops, it's a pure-proxy controller. just let it go.
					controllerType = prev;
					break;
				}
			}

			return controllerType;
		}