Ejemplo n.º 1
0
        public bool DoesFragmentConditionMatch(ExecutionContext context, IHaveFragmentType fragment, GraphType type)
        {
            if (string.IsNullOrWhiteSpace(fragment.Type))
            {
                return(true);
            }

            var conditionalType = context.Schema.FindType(fragment.Type);

            if (conditionalType == null)
            {
                return(false);
            }

            if (conditionalType.Equals(type))
            {
                return(true);
            }

            if (conditionalType is GraphQLAbstractType)
            {
                var abstractType = (GraphQLAbstractType)conditionalType;
                return(abstractType.IsPossibleType(type));
            }

            return(false);
        }
Ejemplo n.º 2
0
        public bool DoesFragmentConditionMatch(ExecutionContext context, IHaveFragmentType fragment, GraphType type)
        {
            var conditionalType = context.Schema.FindType(fragment.Type);

            if (conditionalType == type)
            {
                return(true);
            }

            if (conditionalType is InterfaceGraphType)
            {
                var interfaceType = (InterfaceGraphType)conditionalType;
                var hasInterfaces = type as IImplementInterfaces;
                if (hasInterfaces != null)
                {
                    var interfaces = context.Schema.FindTypes(hasInterfaces.Interfaces);
                    return(interfaceType.IsPossibleType(interfaces));
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
        public bool DoesFragmentConditionMatch(ExecutionContext context, IHaveFragmentType fragment, GraphType type)
        {
            var conditionalType = context.Schema.FindType(fragment.Type);
            if (conditionalType == type)
            {
                return true;
            }

            if (conditionalType is InterfaceGraphType)
            {
                var interfaceType = (InterfaceGraphType) conditionalType;
                var hasInterfaces = type as IImplementInterfaces;
                if (hasInterfaces != null)
                {
                    var interfaces = context.Schema.FindTypes(hasInterfaces.Interfaces);
                    return interfaceType.IsPossibleType(interfaces);
                }
            }

            return false;
        }
Ejemplo n.º 4
0
        public bool DoesFragmentConditionMatch(ExecutionContext context, IHaveFragmentType fragment, GraphType type)
        {
            var conditionalType = context.Schema.FindType(fragment.Type);
            if (conditionalType == type)
            {
                return true;
            }

            if (conditionalType is InterfaceGraphType)
            {
                return ((InterfaceGraphType)conditionalType).IsPossibleType(type as IImplementInterfaces);
            }

            return false;
        }
Ejemplo n.º 5
0
        public bool DoesFragmentConditionMatch(ExecutionContext context, IHaveFragmentType fragment, GraphType type)
        {
            if (string.IsNullOrWhiteSpace(fragment.Type))
            {
                return true;
            }

            var conditionalType = context.Schema.FindType(fragment.Type);

            if (conditionalType == null)
            {
                return false;
            }

            if (conditionalType.Equals(type))
            {
                return true;
            }

            if (conditionalType is GraphQLAbstractType)
            {
                var abstractType = (GraphQLAbstractType) conditionalType;
                return abstractType.IsPossibleType(type);
            }

            return false;
        }