1

这是基类中的属性

[ReadOnly(true), Display(GroupName = "Payment Details")]
public virtual GridViewModel<PaymentDetails> Details { get; set; } 

这是继承类中的属性

[Display(AutoGenerateField = false, AutoGenerateFilter = false), ScaffoldColumn(false)]
public override GridViewModel<PaymentDetails> Details { get; set; } 

我得到 Method 只能在 Type.IsGenericParameter 为 true 的类型上调用。错误这是调用堆栈的一部分

[InvalidOperationException: Method may only be called on a Type for which Type.IsGenericParameter is true.]
   System.RuntimeType.get_DeclaringMethod() +9546416

[TargetInvocationException: Property accessor 'DeclaringMethod' on object 'System.RuntimeType' threw the following exception:'Method may only be called on a Type for which Type.IsGenericParameter is true.']
   System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) +400
   System.Web.Mvc.<>c__DisplayClassb.<GetPropertyValueAccessor>b__a() +18
   System.Web.Mvc.ModelMetadata.get_Model() +19
   System.Web.Mvc.TemplateInfo.Visited(ModelMetadata metadata) +69
4

0 回答 0