0

My OData v4 client uses generated classes based on the 6.x version of Microsoft.OData.Client.

Now it needs to call an action with the following definition:

  <Action Name="Resolve">
    <Parameter Name="CertRequestEntity" Type="CertificationRequest" />
    <Parameter Name="CertRequestId" Type="Edm.String" Nullable="false" Unicode="false" />
    <Parameter Name="RequestSuccess" Type="Edm.Boolean" Nullable="false" />
    <Parameter Name="RejectedMessage" Type="Edm.String" Unicode="false" />
  </Action>

It is easy to construct primitive parameters with the aid of the BodyOperationParameter class, but I cannot find any documentation on the proper way to construct an entity reference as a parameter. Is this possible? (I ended up using HttpClient with a hand-rolled JSON body.)

1 Answers1

0

Note that the definition above, as written, is invalid; the type of the first parameter should be namespace qualified.

If you have control over the schema, the simplest solution would be to make this a bound action (IsBound="true" on the action definition). Bound actions are similar to extension methods in .NET -- the first (entity) parameter becomes the "binding parameter", and you would call the action by appending the action name (/Resolve) to the URL for the CertificationRequest that you wanted to resolve, passing the remaining (non-binding) parameters in the body.

  • I can file a bug for the service owner. However, wouldn't the addition of `IsBound` be a breaking change for existing clients of this service? – Jeff Roberts Nov 15 '19 at 23:43