Linoy.M.K Linoy.M.K - 1 year ago 455
C# Question

Odata with unbound function : The related entity set or singleton cannot be found from the OData path

I am looking to create an unbound function inside ProductController which return entirely different entity(Not related to Product).

public class ProductsController : ODataController
public IHttpActionResult InvokeMyUnBoundFunction(int id)
TestUnBound testObj= new TestUnBound();
testObj.Name = "Test" + id;
return Ok(testObj);

and my webApiConfig is

ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<TestUnBound>("TestUnBounds"); //Its not related to Product.

But when I invoked
I got an error message like

"The related entity set or singleton cannot be found from the OData
path. The related entity set or singleton is required to serialize the

Am I missed any concepts?

Answer Source

You should use


instread of

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download