Remove incorrect override of `ModelMetadata.GetDisplayName()`
- this method delegates to a number of `ModelMetadata` properties - no use cases for overriding; should not be `virtual` - `ModelMetadata.DisplayName` override using `DisplayAttribute.GetName()` coming in next commit
This commit is contained in:
parent
b1912d799c
commit
f4b582f654
|
|
@ -99,22 +99,6 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
: base.ComputeShowForEdit();
|
||||
}
|
||||
|
||||
public override string GetDisplayName()
|
||||
{
|
||||
// DisplayAttribute doesn't require you to set a name, so this could be null.
|
||||
if (PrototypeCache.Display != null)
|
||||
{
|
||||
var name = PrototypeCache.Display.GetName();
|
||||
if (name != null)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
// If DisplayAttribute does not specify a name, we'll fall back to the property name.
|
||||
return base.GetDisplayName();
|
||||
}
|
||||
|
||||
private static void ValidateDisplayColumnAttribute(DisplayColumnAttribute displayColumnAttribute,
|
||||
PropertyInfo displayColumnProperty, Type modelType)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string GetDisplayName()
|
||||
public string GetDisplayName()
|
||||
{
|
||||
return PropertyName ?? ModelType.Name;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue