Reputation: 4747
I was following this sample to create Odata end-point
In this it says:
Note that an endpoint can have multiple entity sets. Call EntitySet for each entity set, and then define a corresponding controller.
Now, I cant have a controller for every single entity set and I want to give OData support.
If I want to have multiple entity sets in a single controller how do I go about doing it?
Regards.
Upvotes: 5
Views: 6314
Reputation: 1307
This might be a decent sample to give you some ideas. It creates Dynamic OData Routes
https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/OData/v4/DynamicEdmModelCreation/
Upvotes: 1
Reputation: 2995
The default routing convention determines the controller name by the entity set name.
If you have multiple entity sets in a single controller, how can WebAPI select the correct controller?
Unless you use attribute routing convention or your self-defined routing convention for each action in the controller, which I think is ugly and not recommended.
Check this for attribute routing:
Upvotes: 0