Understanding Model Binding

Model binding is the process of creating .NET objects using the data sent by the browser in an HTP request. I touched on model binding in Chapter 23, but let's recap that example to set a foundation for this chapter, going back and resetting the code for our RegistrationController class. Listing 29-1 shows the contents of the controller.

Listing 29-1. The basic RegistrationController class

using System.Web.Mvc; using EventRegistration.Models.Domain; using EventRegistration.Models.Domain.Repository; namespace EventRegistration.Controllers {     public class RegistrationController : Controller {         private IRepository repository;         public RegistrationController(IRepository repo) {             repository ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.