odata

Use LINQ for double-nested OData collection

泄露秘密 提交于 2019-12-24 07:06:55
问题 I've got a custom OData feed that for books. Each book can have multiple authors and an author can be involved in multiple books so I implemented this using a join table (Book - BookAuthorJoin - Author). My proxy object has Book.BookAuthorJoins BookAuthorJoin.Books & BookAuthorJoin.Authors. What I want todo is have a single query where I get all the books for an author in a single LINQ query, but having trouble applying the filter. Seems I want two Expand() methods, but that isn't working.

Writing a simple OData client: how to query service?

三世轮回 提交于 2019-12-24 07:00:38
问题 I am trying to adapt this example to create a simple OData client. Before that, I added a service reference in Visual Studio to "http://services.odata.org/Northwind/Northwind.svc/". By this step I got many classes like "Alphabetical_list_of_product". But how do I get the alphabetical list of products, for example? Specifically, in the example the author just starts with: OdataClient.NorthwindOdataService.NorthwindEntities dc = new OdataClient.NorthwindOdataService.NorthwindEntities( new Uri(

Return more than 1000 entities of a Windows Azure Table query

谁都会走 提交于 2019-12-24 04:51:53
问题 My question is exactly this one. However, the Azure Storage API has changed and all answers I can find for this question deal with the old version. How do handle queries that return more than 1000 items in the current API version? The query fetching less than 1000 items looks like this: var query = new TableQuery<TermScoreEntity>() .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, Name)); var table = _tableClient.GetTableReference("scores"); foreach (var

Is there a way to handle asp.net core odata errors

ⅰ亾dé卋堺 提交于 2019-12-24 04:41:09
问题 Is there a way to handle asp.net core odata errors? I have a model class DimDateAvailable with one property, a primary key of int DateId , and I make a call like /data/DimDateAvailable?$select=test . Other calls work as expected and return what I'm after - this is a deliberate call to generate a fault, and it fails because there is no property named test on the model. The response comes back as expected, like so: {"error":{"code":"","message":"The query specified in the URI is not valid.

OData routing in Web Api

烈酒焚心 提交于 2019-12-24 04:37:13
问题 I'm trying to enable OData in Web Api. I created OData routing, and a controller that inherits from ODataController , and I want to get some sample data from my application. Here's my code: public class TicketController : BaseWebApiController //inherits from ODataController { [EnableQuery] public IQueryable<TicketModel> Get() { return (_ticketService.GetAll()); } [EnableQuery] public SingleResult<TicketModel> Get([FromODataUri] int id) { return (_ticketService.Get(id)); } _ticketService is a

Web api odata sending a long $filter string results in maxurlstring exceeds error

天大地大妈咪最大 提交于 2019-12-24 04:00:21
问题 I am trying to send a large $filter string to my webapi odata endpoint.But it gives me error saying the size of request headers are too long/maxurlstringlength exceeds. Is there a way to send the $filter in "POST" request and query the odata endpoint? i cannot use the batch statement as i am using .net framework 4.0. 来源: https://stackoverflow.com/questions/20187787/web-api-odata-sending-a-long-filter-string-results-in-maxurlstring-exceeds-erro

JayData oData request with custom headers - ROUND 2

依然范特西╮ 提交于 2019-12-24 03:48:12
问题 Few month back I was working on some Odata WCF project and I had some problems with parsing custom headers for token auth (apiKey). At that time, being quite a noob (still am!), I posted this SO question: JayData oData request with custom headers Today I am working on a new project with Jaydata Odata server and client library and this: application.context.prepareRequest = function (r) { r[0].headers['apikey'] = '123456'; }; was working fine till I had to do a MERGE request. I found out that

How is it possible to use OData in .net core application?

做~自己de王妃 提交于 2019-12-24 03:35:11
问题 According to docs (http://odata.github.io/WebApi/#11-01-OData-V4-Web-API-Scaffolding) it is required to inherit from ODataController. I have installed package using nuget and still not able to inherit from that class. Does OData support .net core? Are docs obsolete? 回答1: A possible duplicate of OData Support in ASP.net core The docs link that you mentioned is targeting .NET Framework. For .NET Core support, please download the Microsoft.AspNetCore.OData NuGet Package from https://www.nuget

Using the apicontroller to return odata.$count

梦想与她 提交于 2019-12-24 03:12:32
问题 I have controllers that inherit from ApiController. I have the EnableQuery attribute at the top of it to allow ODATA query strings. However $count does not work. For eg:- ../products?$count=true does return data with no odataexception, but does not return the count. Any suggestions 回答1: You can get count separately and put it in new dictionary together with data, returning this dictionary in the method of your controller. The following code applies all that was specified in OData query

Odata Query with DataServiceContext and get result as json

↘锁芯ラ 提交于 2019-12-24 02:30:16
问题 I have a DataServiceContext querying my WCF Data Service: service = new DataServiceContext(new Uri(SvcUrl)); service.SendingRequest += new EventHandler<SendingRequestEventArgs> (OnSendingRequest); I want to set the Accept header so that I get the result as json: static void OnSendingRequest(object sender, SendingRequestEventArgs e) { e.RequestHeaders.Set("Accept", "json/text"); } But I get an exception: "This header must be modified using the appropriate property or method. Parameter name: