odata-v4

Is it possible to expose multiple Odata v4 endpoints in Asp.Net WebApi project

时光毁灭记忆、已成空白 提交于 2019-12-01 14:04:20
问题 The title explains the requirement. Is it possible to expose multiple endpoints in single project? Something like: http://localhost:8000/svc1/$metadata http://localhost:8000/svc2/$metadata http://localhost:8000/svc3/$metadata Because I need to divide functionality into multiple components. Can anyone help me? UPDATE Currently I'm using below code to create and expose Odata service. public void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); ConfigureRoute

How to get Web API OData v4 to use DateTime

风流意气都作罢 提交于 2019-11-27 18:10:52
I have a fairly large data model that I want to expose using Web API OData using the OData V4 protocol. The underlying data is stored in a SQL Server 2012 database. That database has many DateTime columns in it. As I was wiring it up I got an error that System.DateTime is not supported. So here is my question, what can I do to get my DateTime columns to be seen in the OData feed? NOTE: I am not able to go back and change all my columns to DateTimeOffset columns. I tried changing the type of the column in the Entity Framework edmx, but it gave me this error: Member Mapping specified is not

odata - combining $expand and $select

冷暖自知 提交于 2019-11-27 14:34:59
问题 In odata v4.0 is there an option for combining $expand and $select together? I have a scenario wherein I'm trying to get specific columns in productItemChoices and item. The below query will give you all the columns in productItemChoices. I only need one column in the productItemChoices odata/Products(08f80b45-68a9-4a9f-a516-556e69e6bd58)?$expand=productItemChoices($expand=item($select=name)) 回答1: After going through a lot of time on this, I finally got the answer. We can nest select within

Override host of webapi odata links

风流意气都作罢 提交于 2019-11-26 22:08:58
问题 I'm using WebAPI 2.2 and Microsoft.AspNet.OData 5.7.0 to create an OData service that supports paging. When hosted in the production environment, the WebAPI lives on a server that is not exposed externally, hence the various links returned in the OData response such as the @odata.context and @odata.nextLink point to the internal IP address e.g. http://192.168.X.X/<AccountName>/api/... etc. I've been able to modify the Request.ODataProperties().NextLink by implementing some logic in each and