user386167
user386167

Reputation:

ASP.NET MVC -URL structure recommendations

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?

Upvotes: 1

Views: 369

Answers (2)

RPM1984
RPM1984

Reputation: 73132

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.

Upvotes: 2

gandjustas
gandjustas

Reputation: 1955

It depends on problem you want to solve.

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

Upvotes: 1

Related Questions