tags:

views:

79

answers:

2

I have build a production system using ASP.NET MVC 1 and am now playing and preparing a talk on the second installment.

One peculiar thing that I can't comprehend is why all controllers and action methods have gone partial and virtual.

This question will surely pop-up at the Q&A round and I have no answer to it. So please if somebody knows what this has been done please share your knowledge with me.

A: 

They had not (AFAIK). Are you maybe using T4MVC (which converts controllers to partials and actions to virtuals)?

Edit: ouch. I have just remembered that I have still the RC1. Please ignore my answer if this is issue on RC2.

Cheers!

rrejc
+2  A: 

They are declared partial for the purpose of extensibility.

Every group of controller actions (for a single controller) can for example be contained in a separate file. This can improve maintainability of your source code.

A nice example of how the partial classes are used is in the Telerik MVC Extensions example project.

Rik
+1 for grouping controller actions. Hadn't thought of it that way before.
Robert Harvey