/// <summary>
        /// Returns the proper graph type for the specified object for this abstract graph type. If the abstract
        /// graph type implements <see cref="IAbstractGraphType.ResolveType"/>, then this method is called to determine
        /// the best graph type to use. Otherwise, <see cref="IObjectGraphType.IsTypeOf"/> is called on each possible
        /// graph type supported by the abstract graph type to determine if a match can be found.
        /// </summary>
        public static IObjectGraphType GetObjectType(this IAbstractGraphType abstractType, object value, ISchema schema)
        {
            var result = abstractType.ResolveType != null
                ? abstractType.ResolveType(value)
                : GetTypeOf(abstractType, value);

            if (result is GraphQLTypeReference reference)
            {
                result = schema.AllTypes[reference.TypeName] as IObjectGraphType;
            }

            return(result);
Пример #2
0
 public static IObjectGraphType GetObjectType(this IAbstractGraphType abstractType, object value)
 {
     return(abstractType.ResolveType != null
         ? abstractType.ResolveType(value)
         : GetTypeOf(abstractType, value));
 }