Thursday, February 25, 2010

ASP.NET MVC2 – Adventures of the plain old beginner. Part 1 – Structuring the project.

Theoretical preparation is over! It’s time to get hands dirty with ASP.NET MVC2 and Silverlight 3. Having read “ASP.NET in Action” and “Pro Silverlight 3” here is naive me starting with real work to be done.

Tools.

Visual Studio 2010 RC, Silverlight 3, ASP.NET MVC2 RC (installed alongside with vs2010rc). Mercurial source control with vs2010 integration. Gallio, MbUnit, WatiN from the testing side.

Structuring the solution.

My thoughts on the project structure would be to include Areas and I wish I could split controllers in separate projects from views.

Area controllers to be in a separate project from views.

Quite fails, and not able to find any guidance by googling. – Giving up, not a priority right now for me.

Multi-project areas.
Fails again. MS gave up on this feature as part of a core product for MVC2 (http://forums.asp.net/p/1516088/3629558.aspx). There is a link provided for the custom build task required, but it points to the no-release http://aspnet.codeplex.com/releases/view/37423 image

As I’ve found no single evidence of this to work, I’m giving it up, not in my principal scope right now.

Default Area.

After fallback to the single project areas I wanted to split into 2 areas at least: Admin and View. What I wanted as well would be getting into /View/Home/Index for the / url by simple setting of routing and without some redirect from the /Home/Index. Within 10 minutes planned I was not able to figure it out and leaving for a later time.

Recap.

images Out of 3 things I wanted from my solution structure none was really feasible. My wow feeling on MS MVC faded down a bit. VS2010rc crashing down up to 5 times during a day (with intellisense crash patch installed) added a bit to the sad experience.

Hopefully DI will help me to have a re-match on a 0:3 score from today, but this is planned for further iterations. Lets see.

Next.

Will be moving forward with test tools setup and putting some lame tests in place first to get a feeling of unit and integration tests with Gallio, WatiN and MbUnit.

Platform and tools: Windows 7, VS2010RC, ASP.NET MVC2 RC, Gallio, MbUnit, NUnit, Moq, Silverlight 3.0

2 comments:

adam.mokan said...

Check out the MvcContrib "Portable Areas" feature (http://goo.gl/6C2O). I also was planning to use the feature that was built-in to the MVC2 Preview, but then it disappeared on the RC. (there was posts about this on a few blogs)

In regards to Portable Areas, there was just a "live" web presentation last week on this by the guys that maintain the project. I planned to join the live meeting, but will have to check the video our notes out sometime this week.

Hope it helps

URL to the video (scroll down) - http://goo.gl/TxdE

stan said...

Thanks Adam,
I will definitely take a look, having some better structure will be a blessing for a mid/bigger project.