Los Techies : Blogs about software and anything tech!

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.

Kick It on DotNetKicks.com
Posted Feb 20 2009, 11:04 AM by jcteague

Comments

Hadi Hariri wrote re: The MVC Template Team Got It Right
on 02-20-2009 1:54 PM

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.

ASP.NET MVC Archived Blog Posts, Page 1 wrote ASP.NET MVC Archived Blog Posts, Page 1
on 02-23-2009 8:43 AM

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

Enter the numbers above:
Copyright Los Techies 2008, 2009. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems