Example #1
0
        public override void Process(
            Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context,
            Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output)
        {
            System.Reflection.PropertyInfo modelAttributesProperty =
                For.Metadata.GetType().GetProperty("Attributes");

            Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes modelAttributes =
                modelAttributesProperty.GetValue(For.Metadata)
                as Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes
            ;


            object a = System.Linq.Enumerable.FirstOrDefault(modelAttributes.PropertyAttributes
                                                             , m => m.GetType() == typeof(System.ComponentModel.ReadOnlyAttribute)
                                                             );

            if (a is System.ComponentModel.ReadOnlyAttribute readOnlyAttribute &&
                readOnlyAttribute.IsReadOnly == true)
            {
                Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute attribute =
                    new Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("disabled", "disabled");
                output.Attributes.Add(attribute);
            }

            base.Process(context, output);
        } // End Sub Process
 public bool Equals(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute other)
 {
     throw null;
 }
Example #3
0
 public void AddTagHelperAttribute(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute attribute)
 {
 }