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:
dougbu 2014-06-13 12:53:40 -07:00
parent b1912d799c
commit f4b582f654
2 changed files with 1 additions and 17 deletions

View File

@ -99,22 +99,6 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
: base.ComputeShowForEdit(); : 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, private static void ValidateDisplayColumnAttribute(DisplayColumnAttribute displayColumnAttribute,
PropertyInfo displayColumnProperty, Type modelType) PropertyInfo displayColumnProperty, Type modelType)
{ {

View File

@ -203,7 +203,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
} }
} }
public virtual string GetDisplayName() public string GetDisplayName()
{ {
return PropertyName ?? ModelType.Name; return PropertyName ?? ModelType.Name;
} }