How to address entity that uses composite identity key in OData Url?
问题 I have an entity OrderItem that has OrderId and ProductId integer fields and these two fields form the identity key/primary key for this table. I would like to use OData/Web API to expose such entities through a service and to be able to select OrderItem instances by they composite ID . What should be the format of the URL ? Are there any best practices for handling such scenarios? 回答1: Composite keys in the URL use syntax like this: ~/OrderItems(OrderId=1234,ProductId=1234) The "grammar" is