tags:

views:

662

answers:

2

In making a restful ASP.NET MVC app I'm wondering about the best way to structure the projects in my solution. By convention, the controllers reside in the same project as the views. However, if I have a few different presentation tiers accessing my restful controllers, would it be better to put my controllers in a layer (project) lower than my views?

+1  A: 

It was my understanding that the MVC controllers are an abstraction of page behavior and data access, but are still coupled to the views they drive. I imagine you could get away with pulling the MVC controllers out of the project, but you would likely kill the benefit of removing duplicate code by having to make everything the controllers do way to general.

Edit: Your question is pretty much the same as this one.

Ty
+1  A: 

Sounds like you're using MVC controllers to build a services tier to be called by various other components in your architecture.

I would consider moving that code to a "services" project and maybe use WCF to build the services.

Eran Kampf