示例#1
0
        /// <summary>
        /// Logs the details of the <see cref="ModeMatchResult{TMode}"/>.
        /// </summary>
        /// <param name="logger">The <see cref="ILogger"/>.</param>
        /// <param name="tagHelper">The <see cref="ITagHelper"/>.</param>
        /// <param name="uniqueId">The value of <see cref="TagHelperContext.UniqueId"/>.</param>
        /// <param name="viewPath">The path to the view the <see cref="ITagHelper"/> is on.</param>
        public void LogDetails <TTagHelper>(
            [NotNull] ILogger logger,
            [NotNull] TTagHelper tagHelper,
            string uniqueId,
            string viewPath)
            where TTagHelper : ITagHelper
        {
            if (logger.IsEnabled(LogLevel.Warning) && PartiallyMatchedAttributes.Any())
            {
                // Build the list of partial matches that contain attributes not appearing in at least one full match
                var partialOnlyMatches = PartialMatches.Where(
                    match => match.PresentAttributes.Any(
                        attribute => PartiallyMatchedAttributes.Contains(
                            attribute, StringComparer.OrdinalIgnoreCase)));

                logger.LogWarning(new PartialModeMatchLogValues <TMode>(uniqueId, viewPath, partialOnlyMatches));
            }

            if (logger.IsEnabled(LogLevel.Verbose) && !FullMatches.Any())
            {
                logger.LogVerbose(
                    "Skipping processing for tag helper '{TagHelper}' with id '{TagHelperId}'.",
                    tagHelper.GetType().GetTypeInfo().FullName,
                    uniqueId);
            }
        }
        public bool Any()
        {
            bool b = ExactMatches != null?ExactMatches.Any() : false;

            bool b2 = PartialMatches != null?PartialMatches.Any() : false;

            bool b3 = PopularTitles != null?PopularTitles.Any() : false;

            return(b || b2 || b3);
        }