Pomona.RequestProcessing.HandlerMethod.MatchMethodReturningQueryable C# (CSharp) Method

MatchMethodReturningQueryable() private method

private MatchMethodReturningQueryable ( ResourceType resourceType ) : RouteAction
resourceType Pomona.Common.TypeSystem.ResourceType
return Pomona.Routing.RouteAction
        private RouteAction MatchMethodReturningQueryable(ResourceType resourceType)
        {
            // Check that the method is called "Get", "Query", "Get<TypeName>s" or "Query<TypeName>s".
            if (!MethodInfo.Name.Equals("Get") && !MethodInfo.Name.Equals("Query") &&
                !MethodInfo.Name.Equals("Get" + resourceType.PluralName) &&
                !MethodInfo.Name.Equals("Query" + resourceType.PluralName))
                return null;

            // Check that the it takes a parameter of type Parent if the type is a child resource of Parent.
            if (resourceType.ParentResourceType != null)
            {
                var parentParameter = MethodInfo.GetParameters();
                if (parentParameter.Length != 1 ||
                    parentParameter[0].ParameterType != resourceType.ParentResourceType.Type)
                    return null;
            }

            // Check that it returns an IQueryable<Object>.
            if (!typeof(IQueryable<>).MakeGenericType(resourceType.Type).IsAssignableFrom(MethodInfo.ReturnType))
                return null;

            return new DefaultHandlerMethodInvoker(this);
        }