Reputation: 131
In MVC 4 and 5 model metadata has property "Model"
In MVC 6 (ASP.Net core mvc), this property is gone.
So now, how do I get "Model" from model metadata?
Upvotes: 1
Views: 1307
Reputation: 131
Found solution.
ViewData has ModelExplorer, where can find property by modelmetadata.
ViewData.ModelExplorer.Properties.SingleOrDefault(x => Equals(x.Metadata, metadata)).Model
Upvotes: 2