0

New to OData and I have a question I cannot seem to find a solid solution for. I admit this might just be info overload and I cannot find the right path. So I am looking for at least a path forward.

I have OData wired up and working. Middleware and configuration all setup and initialized. I can run test queries against some endpoints. My issue is with the types my endpoints return. We are wrapping our result objects with some additional information. There is a ResponseList object that contains an IEnumerable<T> with the data returned as well as some additional information for the response. This ResponseList is just a wrapper.

public class ResponseList<T>
{
    public ResponseList(IEnumerable<T> data, string extraInfo = null)
    {
        Data = data;
        ExtraInfo = extraInfo;
    }

    public IEnumerable<T> Data { get; set; }
    public string ExtraInfo { get; set; }
}

My endpoints will return the ResponseList<ReturnItems> and OData will show the object. Yet I don't care about the ExtraInfo stuff and only the IEnumerable<ReturnItems> information.

How can I setup EDM or define this model type to return only that info?

2
  • Do you mean you want to return the ResponseList<T> type but the EDM is for the ReturnItems? Commented May 20 at 8:58
  • Yea all I want is the IEnumerable data from that object.
    – Tom
    Commented May 20 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.