2

Closed

OData actions do not work if the model has KeyValuePair<string, object>.

description

1) Create a model having an ODataAction.
2) Add a complex type KeyValuePair<string, object> to the model like this,
model.ComplexType<KeyValuePair<string, object>>();


3) Try accessing that action. ODataFormatter fails with model state error,
{Microsoft.Data.OData.ODataException: A top-level property with name 'IsUser' was found in the payload; however, property and collection payloads must always have a top-level property with name 'value'.
This is because ODataActionParameters is IDictionary<string, object> which is IEnumerable<KeyValuePair<string, object>>. So ODataFormatter thinks that ODataActionParameters is a EDM collection type.
Closed Sep 5, 2013 at 1:23 AM by kichalla
Verified.

comments

raghuramn wrote Aug 23, 2013 at 10:13 PM

TristanKazu wrote Aug 27, 2013 at 1:05 PM

Thanks for fixing this. I can already confirm that it is indeed working.

raghuramn wrote Aug 27, 2013 at 7:23 PM

TristanKazu: No problem. Thanks for reporting this and trying out the fix.