Thursday, July 28, 2011

Single Action per Controller in ASP.NET MVC - Jak Charlton - Insane World - Devlicio.us - Just the Tasty Bits

Single Action per Controller in ASP.NET MVC - Jak Charlton - Insane World - Devlicio.us - Just the Tasty Bits

As I keep doing this on MVC projects, thought I may as well blog it, so the next time I need it I can find it myself :)

To keep ASP.NET MVC controllers clean and organised, I find it much easier to split them so they handle only a single action each. This helps significantly with maintaining some semblance of the Single Responsibility Principle, allowing each controller to deal with a single action, and not have concerns like Logon, Logoff and ChangePassword all start globbing together under a single controller called "Account".

No comments:

Post a Comment