The MVC Template Team Got It Right

I just created my first project with ASP.Net MVC RC1 and I had a pleasant surprise!!

As with the beta, when you create a new project with the MVC project template, it creates a AccountConroller as part of the startup code.  In the beta, all of the logic to handle user login and authentication was directly in the Action method.  This completely violates Separation of Concerns.

With RC1 this code looks much better, they created IFormAuthentication and IMembershipService interfaces and added them to the constructor (for constructor dependency injection) and now all work is delegated to these interfaces.

Kudus MVC team!! This is the correct design for both SoC and for testing purposes.  For RTM, could you also include the correct unit tests for this controller to further reinforce the need for testing.

Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://hadihariri.com Hadi Hariri

    I doubt they’ll change anyhing for RTM because it’s in RC, but it would be really cool if they would make the whole AccountController thing a minor little tickbox on the New App wizard. If they did the same with the MS.Ajax libs, even better, not to mention also prompting to create the scafolding when creating CRUD operations.

    They could have added so much with such little effort.