Пример #1
0
        // We need to filter out the duplicate tag helper descriptors that come from the
        // open file in the editor. We mangle the class name for its generated code, so using that here to filter these out.
        internal static bool IsTagHelperFromMangledClass(TagHelperDescriptor tagHelper)
        {
            StringSegment className;

            if (tagHelper.IsChildContentTagHelper())
            {
                // If this is a child content tag helper, we want to look at it's original type.
                // E.g, if the type name is `Test.__generated__MyComponent.ChildContent`, we want to look at `Test.__generated__MyComponent`.
                TrySplitNamespaceAndType(tagHelper, out var typeNamespace);
                return(TrySplitNamespaceAndType(typeNamespace, out var _, out className) &&
                       ComponentMetadata.IsMangledClass(className));
            }

            return(TrySplitNamespaceAndType(tagHelper, out var _, out className) &&
                   ComponentMetadata.IsMangledClass(className));
        }
Пример #2
0
    public static bool IsComponentOrChildContentTagHelper(this TagHelperDescriptor tagHelper)
    {
        if (tagHelper == null)
        {
            throw new ArgumentNullException(nameof(tagHelper));
        }

        if (tagHelper.IsComponentTagHelper())
        {
            return(true);
        }

        if (tagHelper.IsChildContentTagHelper())
        {
            return(true);
        }

        return(false);
    }