1

Since ASP.Net 2012.2 was released I have been attempting to create a Web API which returns OData which in turn can be consumed by PowerPivot. I have this working with a predefined model.

However I have a scenario whereby I will not know the number of properties prior to the request being made. What I would like to do is be able to execute a stored procedure to get a DataTable and be able to return the contents of this DataTable as odata.

My initial attempts with returning an IQueryable<DataRow> ended up with the following response.

Response, Status=406 (NotAcceptable), Method=GET, Url=http://localhost:43438/odata/Products, Message='Content-type='none', content-length=unknown'

I have since attempted to use ExpandoObject to create a dynamic object to represent the contents of the DataTable however this also gives the response above.

Is there a feasible way to use a dynamic number of properties and serialize this to OData?

4

1 回答 1

-1

您应该构建 EDM 模型并添加 OData 路由。有关公开 odata 服务的 3 个步骤,请参阅此博客文章

于 2013-02-21T20:17:58.490 回答