Since Web API OData V6.0.0 beta, Web API OData supports the composite key convention binding.
Let’s have an example:
Where, Customer is an entity type with three properties.
We will make all these trhee properties as the composite keys for Customer entity type.
So, we can do:
Before Web API OData V6.x, key segment convention routing only supports the single key convention binding, just use the key as the parameter name.
In Web API OData V6.x, we use the following convention for the composite key parameter name, but leave the key for single key parameter.
Therefore, for StringProp key property, the action parameter name should be keyStringProp.
Let’s see how the contoller action looks like:
Now, you can issue a request:
The result is:
Be noted, this rule also applys to the navigation property key convention binding.