source code bean

19 Apr, 2010

First steps toward EPiServer and ASP.NET MVC

Posted by: Peter In: ASP.NET| C#| EPiServer| Web

Recently I started a new assignment at a customer where we are going to build their new public web site and their intranet, both of them based on EPiServer CMS 6. The person leading the project is very found of ASP.NET MVC, so my first task was to experiment with EPiServer and ASP.NET MVC, to try to get a running prototype up.

I did some research online to see what others had done. I found two great posts by Joel Abrahamsson and one from Fabio Fabrizio, who based his solution on Joels experiments.

Joels first attempt was to create a base class from which all Controllers inherited. However, this made the controller do more than it should and made it very hard to test. His second attempt was to create a custom model binder and make every action receive currentPage as a parameter. This approach makes it much easier to create unit tests for the code, since it is now possible to moc the currentPage parameter.

Fabio took a different approach and decided to implement a custom MVC handler and a controller factory. This approach fits very well with MVC and felt like the right way to go, so I decided to create a prototype based on Fabios code. Fabios code was based on EPiServer CMS 5 and ASP.NET MVC 1.0, but I wanted to use EPiServer 6 and ASP.NET MVC 2.0, so I started porting the solution.

Porting the solution to EPiServer 6 and ASP.NET MVC 2.0 required some changes to both code and configuration, which not all of them was trivial. At the moment I have a prototype up running, and it works remarkably well! I will continue my experiments and post my results.

3 Responses to "First steps toward EPiServer and ASP.NET MVC"

1 | Mark Everard

April 20th, 2010 at 10:10 am

Avatar

Great work. I’m really interested to see how this turns out

2 | Pablo

May 14th, 2010 at 1:31 pm

Avatar

What’s EpiServer MVC 5?

3 | Peter

May 21st, 2010 at 6:20 am

Avatar

@Pablo, oops that was a typo. It should of course be EPiServer CMS 5

Comment Form

Categories

Adwords

Twitter Updates

    About

    Welcome to source code bean! You will find information on tips and tricks on programming languages, server side stuff, and anything that causes troubles to web development.