コード例 #1
0
        /// <summary>
        /// Attempts to find the fully qualifed <see cref="GraphFieldPath"/> that is pointed at by the supplied event name.
        /// </summary>
        /// <param name="schema">The schema.</param>
        /// <param name="eventName">The short or long name of the event.</param>
        /// <returns>System.String.</returns>
        public static GraphFieldPath RetrieveSubscriptionFieldPath(this ISchema schema, SubscriptionEventName eventName)
        {
            Validation.ThrowIfNull(schema, nameof(schema));
            Validation.ThrowIfNull(eventName, nameof(eventName));

            if (eventName.OwnerSchemaType != schema.FullyQualifiedSchemaTypeName())
            {
                return(null);
            }

            if (NAME_CATALOG.TryGetValue(eventName, out var routePath))
            {
                return(routePath);
            }

            // attempt to load the schema into the cache in case it wasnt before
            if (PreLoadSubscriptionEventNames(schema))
            {
                if (NAME_CATALOG.TryGetValue(eventName, out routePath))
                {
                    return(routePath);
                }
            }

            return(null);
        }