Esempio n. 1
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;
        }
Esempio 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;
        }
        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;
        }