コード例 #1
0
        private string[] GetMethodParameters(TagHelperDescriptor tagHelper)
        {
            var viewComponentName = tagHelper.GetViewComponentName();
            var methodParameters  = new[] { $"\"{viewComponentName}\"", $"{TagHelperProcessInvokeAsyncArgsMethodName}({TagHelperContextVariableName})" };

            return(methodParameters);
        }
コード例 #2
0
    private string[] GetMethodParameters(TagHelperDescriptor tagHelper)
    {
        var propertyNames       = tagHelper.BoundAttributes.Select(attribute => attribute.GetPropertyName());
        var joinedPropertyNames = string.Join(", ", propertyNames);
        var parametersString    = $"new {{ { joinedPropertyNames } }}";
        var viewComponentName   = tagHelper.GetViewComponentName();
        var methodParameters    = new[] { $"\"{viewComponentName}\"", parametersString };

        return(methodParameters);
    }
コード例 #3
0
            public bool Add(TagHelperDescriptor tagHelper)
            {
                if (_tagHelpers.ContainsKey(tagHelper))
                {
                    return(false);
                }

                var className          = $"__Generated__{tagHelper.GetViewComponentName()}ViewComponentTagHelper";
                var fullyQualifiedName = $"{Namespace.Content}.{Class.ClassName}.{className}";
                var fieldName          = GenerateFieldName(tagHelper);

                _tagHelpers.Add(tagHelper, (className, fullyQualifiedName, fieldName));

                return(true);
            }
コード例 #4
0
 private static string GenerateFieldName(TagHelperDescriptor tagHelper)
 {
     return($"__{tagHelper.GetViewComponentName()}ViewComponentTagHelper");
 }