Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Unassigned: MVC: Make non-generic TryUpdateModel methods [1071]

$
0
0
Sometimes it is necessary to make a polymorphic binding of model on the basis of the interface. But if one pass the model of a particular type, wich implements the necessary interface, the binding doesn't occur because the TryUpdateMethod method is generic. Make overloads, where only the object model would be transfered to the entrance of the method:

bool TryUpdateModel(object model)
bool TryUpdateModel(object model, string prefix)

etc.

Example of usage:

```
public ActionResult Process(SomeDescriminatorEnum someDescriminator)
{
IMyModel model = GetConcreteForm(someDescriminator);
if (TryUpdateModel(model))
{
// ...
}
// ...
}
```

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>