diff --git a/samples/MvcSample.Web/HomeController.cs b/samples/MvcSample.Web/HomeController.cs
index 8b33fe2aee..ef1d3bcaec 100644
--- a/samples/MvcSample.Web/HomeController.cs
+++ b/samples/MvcSample.Web/HomeController.cs
@@ -10,6 +10,13 @@ namespace MvcSample.Web
return View("MyView", User());
}
+ public IActionResult ValidationSummary()
+ {
+ ModelState.AddModelError("something", "Something happened, show up in validation summary.");
+
+ return View("ValidationSummary");
+ }
+
///
/// Action that shows metadata when model is null.
///
diff --git a/samples/MvcSample.Web/Views/Home/ValidationSummary.cshtml b/samples/MvcSample.Web/Views/Home/ValidationSummary.cshtml
new file mode 100644
index 0000000000..9188ca196c
--- /dev/null
+++ b/samples/MvcSample.Web/Views/Home/ValidationSummary.cshtml
@@ -0,0 +1,23 @@
+
+
+
ValidationSummary Test Page.
+Below are all overloads for Html.ValidationSummary. You should see 5 validation summary titles and 4 validation summary error messages.
+
+
+
+ @Html.ValidationSummary()
+ @Html.ValidationSummary(excludePropertyErrors: true)
+ @Html.ValidationSummary(message: "Hello from validation message summary 1.")
+ @Html.ValidationSummary(excludePropertyErrors: true, message: "Hello from validation message summary 2")
+ @Html.ValidationSummary(message: "Hello from validation message summary 3", htmlAttributes: new { style = "color: red" })
+ @Html.ValidationSummary(excludePropertyErrors: true, message: "Hello from validation message summary 4", htmlAttributes: new { style = "color: green" })
+ @Html.ValidationSummary(message: "Hello from validation message summary 5", htmlAttributes: new Dictionary { { "style", "color: blue" } })
+
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ModelMetadata.cs b/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ModelMetadata.cs
index 97b8f7f4cc..b77ed3699d 100644
--- a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ModelMetadata.cs
+++ b/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ModelMetadata.cs
@@ -7,6 +7,8 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{
public class ModelMetadata
{
+ public static readonly int DefaultOrder = 10000;
+
private readonly Type _containerType;
private readonly Type _modelType;
private readonly string _propertyName;
@@ -15,6 +17,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
private bool _convertEmptyStringToNull = true;
private object _model;
private Func