WebApi EntitySetController using composite keys

不羁的心 提交于 2019-12-13 05:01:51

问题


The excellent sample code: Support Composite Key in ASP.NET Web API OData illustrates how to create routing conventions to make WebApi OData work with composite keys.

However it is using ODataController (as one of the unanswered discussions on the sample code mentions) which I presume has many downsides (which I am yet to fully uncover)... has anyone created an example using the benefits of EntitySetController?


回答1:


Going forward the recommended approach is to directly derive from ODataController. Visual Studio 2013 provides scaffolding for creating OData services based on ODataController. This has been found to be a much more flexible model than deriving from EntitySetController. You get complete control over what is done in your actions.



来源:https://stackoverflow.com/questions/22941889/webapi-entitysetcontroller-using-composite-keys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!