ASP.NET MVC - Custom object instantiation / providing with the Modelbinder?

Posted by ropstah on Stack Overflow See other posts from Stack Overflow or by ropstah
Published on 2010-03-29T22:18:28Z Indexed on 2010/03/29 22:23 UTC
Read the original article Hit count: 111

Filed under:
|

Is it possible to customize the object initiation / providing with the default ASP.NET MVC Modelbinder?

<AcceptVerbs(HttpVerbs.Post)> _
Function EditObject(id As int, <Bind(Exclude:="Id")> obj As BLL.Object) As ActionResult

End Function

I would like to 'provide' obj to the modelbinder. (i don't want the Modelbinder to use New() and instantiate obj, but I want to deliver the object from a custom repository.) Is this possible?

Edit: The loading from the repository should be done based on the id parameter of EditObject...

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about modelbinders