ASP.NET Web API, is it good practice to have a controller that is used for ALL business objects?
For example, I have the following route in my controller:
[Route("{resource}/{id}")]
[HttpGet]
public HttpResponseMessage Get(string resource, int id)
{
// code not shown for brevity...
}
Based on this, I have about 50 business objects, and each one has a property named "Resource", which is basically the name of the class as a string (e.g. "Customer", "Order"). In my controller action above, I retrieve a resource using the route parameters "resource" and "id". For example:
GET /Customer/1234 and GET /Order/5678
Is this bad practice? Is it better to create a controller for each business object? What are the pros and cons of each approach?