Hi,
is it possible to use some kind of Multibinders, like this?
[Authorize]
[AcceptVerbs("POST")]
public ActionResult Edit([CustomBinder]MyObject obj)
{
///Do sth.
}
When i ALSO have configured a default binder like this:
protected void Application_Start()
{
log4net.Config.XmlConfigurator.Configure();
RegisterRoutes(RouteTable.Routes);
ModelBinders.Binders.DefaultBinder = new Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder();
}
What i want is to have the benefits of the DataAnnotationsBinder ( which validates the data for stringlength, regexps, etc ) and additionally my custom binder which sets the field values.
I can't write only 1 binder for this, as iam using the EntitiyFramework and in combination with the DataAnnotations it results in contstruct like this:
[MetadataType(typeof(MyObjectMetaData))]
public partial class MyObject
{
}
public class MyObjectMetaData
{
[Required]
[StringLength(5)]
public object Storename { get; set; }
}