Do not repeatedly evaluate `ModelMetadata.Properties` enumeration
- supports useful property updates of `ModelMetadata` instances in the collection - provide a controllable ordering using the `Order` value - part of #964
This commit is contained in:
parent
53432e1483
commit
c0179f74cc
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
|
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
|
||||||
|
|
@ -139,8 +140,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
{
|
{
|
||||||
if (_properties == null)
|
if (_properties == null)
|
||||||
{
|
{
|
||||||
_properties = Provider.GetMetadataForProperties(Model, RealModelType);
|
var properties = Provider.GetMetadataForProperties(Model, RealModelType);
|
||||||
|
_properties = properties.OrderBy(m => m.Order).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _properties;
|
return _properties;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue