odata-v4

Post DbGeography data type in odata v4 api

一世执手 提交于 2021-02-19 06:18:07
问题 What i receive from a DbGeography data type is in Location. { "@odata.context":"http://subdomain.mydomain.me/odata/$metadata#Pois","value":[ { "Id":"d57e6603-5530-4457-b041-6398b7182173","Name":"Demo Home","Address":"Zuidstraat 8 8630 Veurne","Location":{ "Geography":{ "CoordinateSystemId":4326,"WellKnownText":"POINT (51.515574 2.025285)","WellKnownBinary":null } },"TagId":"ec32e8f3-c0b8-4bcc-af6c-7059b1ef1a65","RouteId":null } ] } I have tried multiple POSTS, but none of them seem to succeed

How to Parse OData $filter in C#

浪子不回头ぞ 提交于 2020-08-27 02:17:20
问题 Manipulate odata filter How can i manipulate filter in the backend and want the key value pairs of the filter query parameters? Expression would like below "?$filter =((Name eq 'John' or Name eq 'Grace Paul') and (Department eq 'Finance and Accounting'))" As there are 2 filters concatenated & how can i get the values like Filter 1: Key: Name Operator: eq Value: Name Operator: or Filter 2: Key: Name Operator: eq Value: Grace Paul Operator: and Filter 3: Key: Department Operator: eq Value:

Getting OData Count in ASP.NET Core WebAPI

纵饮孤独 提交于 2020-02-24 06:48:50
问题 Using the sample code from Hassan Habib's Supercharging ASP.NET Core API with OData blog post, I am able to get the record count using an OData query of $count=true : What needs to be configured to get the response object to be wrapped in an OData context so that the @odata.count property will show? In my own ASP.NET Core web API project, I cannot get the simple $count parameter to work and I have no idea why. With Hassan's sample code, the response JSON is wrapped in an OData context and the

Getting related entities ASP.NET WebApi OData v4 results in “No HTTP resource was found that matches the request URI”

本秂侑毒 提交于 2020-02-13 04:50:06
问题 I followed this asp.net tutorial by Mike Wasson, and managed to set up the related entities just fine, but when I applied this logic to my project the more complex entity relations (in that there are more of them; that's the only difference) wouldn't succeed in an OData call, I got a 404 with this payload: { "error": { "code": "", "message": "No HTTP resource was found that matches the request URI 'http://localhost:19215/Menus(c94f7f98-6987-e411-8119-984be10349a2)/MenuPermissions'.",

Getting related entities ASP.NET WebApi OData v4 results in “No HTTP resource was found that matches the request URI”

孤者浪人 提交于 2020-02-13 04:49:26
问题 I followed this asp.net tutorial by Mike Wasson, and managed to set up the related entities just fine, but when I applied this logic to my project the more complex entity relations (in that there are more of them; that's the only difference) wouldn't succeed in an OData call, I got a 404 with this payload: { "error": { "code": "", "message": "No HTTP resource was found that matches the request URI 'http://localhost:19215/Menus(c94f7f98-6987-e411-8119-984be10349a2)/MenuPermissions'.",

OData v4 order by multiple cardinality property

久未见 提交于 2020-01-25 04:38:05
问题 I have the following url: {{hostUrl}}/odata/TasksOData?$select=Id,Name,State,TaskRuns,LastChangedAt,LastChangedBy&$expand=TaskRuns($orderby=RunAt desc;$top=1;$select=Status,RunAt,RunBy)&$top=16&$orderby=TaskRuns/RunBy I want to order Tasks by property from TaskRuns(RunBy). TaskRuns being a collection I want to take into consideration only first item. I get error: "message": "The parent value for a property access of a property 'RunBy' is not a single value. Property access can only be applied

Applying Distinct to OData query

人走茶凉 提交于 2020-01-12 05:46:25
问题 I want to get a list of distinct values from my OData endpoint. But distinct or group by isn't supported yet. My URI query looks something like this GET /odata/Products?$select=foo & $top=10 & $count=true & distinct=true My Controller [EnableQuery] public IQueryable<FooBarBaz> Get(ODataQueryOptions<FooBarBaz> queryOptions, bool distinct) { //I've tried the following return Repository.AsQueryable().Distinct(); // and return Repository.AsQueryable().GroupBy(x => x.Foo); // and IQueryable query

How to join 2 entities in Odata model builder

梦想的初衷 提交于 2020-01-06 12:46:32
问题 I am currently using OData V4 and wish to join 2 tables Account and Product: The tables are as follows: Account: Id, Name, Address, ColorCode, Product: Id, AccountId AccountId in the Product table is a foreign key mapped to the Id field in the Account table In my builder I have : var ProductType= builder.EntityType<Product>(); When I build the Product entity I wish to get the "ColorCode" values from the Account entity. How can i establish this relationship in the model builder? I would like