tags:

views:

27

answers:

2

Is there any standard for setting up URL (Controller) structure? I usually look at my entities and set up a Controller for each entity I need to expose. Is there any standard I am missing? Are there other choices?

+1  A: 

It depends on problem you want to solve.

If you are creating controller with CRUDL methods for each entity consider use Dynamic Data

gandjustas
+2  A: 

The functionality, user experience and URL's should dictate your need for controllers, not the entities.

Look at Rob Conery's MVC StoreFront example - it's a E-Commerce website, and a perfect example.

He creates controllers based on functionality (CatalogController, ShoppingCartController).

Now a "CatalogController" might work with multiple entities, but the "Catalog" is the manager for these entities, much like an aggregate root in the persistence layer.

As for the URL's, this decision should come first, before you decide to create controllers.

Work out what URL's you would like to expose, then decide how to group these URL's into logical areas, then create controllers for each area.

RPM1984
Hi thank you that was really useful.
Bruno Ligutti
No worries, glad to help. :)
RPM1984