C# Blazor从子对象获取父模型类型以进行反射

C# Blazor从子对象获取父模型类型以进行反射,c#,asp.net-core,blazor,C#,Asp.net Core,Blazor,我现在做的是: 子组件 @typeparam TItem @typeparam TValue <input type="text" @bind=Value /> @code { [Parameter] public TValue Value { get; set; } [Parameter] public string PropertyName { get; set; } private void GetCustomAttributes() { P

我现在做的是:

子组件

@typeparam TItem
@typeparam TValue

<input type="text" @bind=Value />

@code {
   [Parameter] public TValue Value { get; set; }
   [Parameter] public string PropertyName { get; set; }

   private void GetCustomAttributes() {
      PropertyInfo prop = typeof(TItem).GetProperty(PropertyName) as PropertyInfo;
      prop.GetCustomAttributes(typeof(RegularExpressionAttribute), false)
      etc ...
   }
}
我怎样才能使它更简单?仅使用绑定值获取ChildComponent中模型的PropertyName和类型

仅提供这些信息或尽可能少提供这些信息:

<ChildComponent TItem="Student" @bind-Value=student.Firstname />

public class Student {

        [MaxLength(10)]
        [RegularExpression(@"[^a-zA-Z ]+")]
        public string Firstname { get; set; }

        [MaxLength(10)]
        [RegularExpression(@"[^a-zA-Z ]+")]
        public string Lastname { get; set; }

        public int Age { get; set; }
    }
<ChildComponent TItem="Student" @bind-Value=student.Firstname />