0

I'm taking a legacy classic asp project up to more modern technology (I've been working with ASP.NET MVC lately so using this concept is stuck in my mind), but I'm trying to think of how to structure the project.

The idea is that the company provides a service to clients, but the service is housed on the company's website (instead of the client's) and has some branding/specifics to the client. Let's say there are 4 or 5 pages/steps for the service, but a few of those pages/steps can be customized for each client. So, what I'd prefer is:

*/step1

*/step2

*/step3

*/step4

*/step5

Where * is the client name but the steps are reusable. This doesn't seem to lend itself to the standard MVC structure, or I can't seem to see the forest for the trees. I wouldn't want a controller for each client and repeat the steps for n clients. I'd rather have 5 steps where step2 or step3 could be expanded upon for client X, expanded upon more for client Y and left alone for client Z.

If the company has 100 clients that want the standard 5 steps (no customization), you wouldn't want 100 controllers serving up 5 steps (500 .cshtml pages in the project)...right? How would one design this properly?

1

The way I would tackle this problem is by using a ControllerFactory to create the appropriate controller based on both the step and client and hand-off the further processing to that controller.

The controller hierarchy would look like this:

BaseController
|
+-- Step1Controller
|
+-- Step2Controller
|   |
|   +-- Step2ClientXController
|   +-- Step2ClientYController
|
+-- Step3Controller
|   |
|   +-- Step3ClientXController
|   +-- Step3ClientZController
|
+-- Step4Controller
|
+-- Step5Controller
  • So, in this scenario, the Step2Controller would be used for clients who do not expand upon step2 and Step2ClientXController would be used for ClientX who wanted to expand upon it? But then these would render Step2.cshtml and Step2ClientX.cshtml? – ethorn10 Oct 4 '13 at 1:09
  • @ethorn10: Yes, but it would depend on the kind of customization that is done for Client X if the Client X specific controller re-uses the generic view or if there is also a customized view. – Bart van Ingen Schenau Oct 4 '13 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.