From the course: ASP.NET MVC: Building for Productivity and Maintainability

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Moving business logic from a controller to a service

Moving business logic from a controller to a service

From the course: ASP.NET MVC: Building for Productivity and Maintainability

Start my 1-month free trial

Moving business logic from a controller to a service

- [Instructor] In this video, I'm not going to talk about any specific ASPNET NBC feature. Instead, I'm going to focus on another practice that folks are often encouraged to follow in tutorials, an approach that may work fine for a small application but it starts to become a problem as an application grows in size and complexity. In fact, this issue is so common it actually has a name. They call it the fat controller pattern. For example, check out the update action on the inventory controller which I've updated to use the request object pattern that I showed in the previous video. Now the problem is even with the conversion to the request object, this method is still so long it doesn't even fit on the screen. As you read this code, keep in mind that the purpose of the controller in the model view controller pattern is to orchestrate interactions between the model and the view. Judging only by the length of it, this method is almost certainly trying to do too much which usually…

Contents