odata

OData route exception

不打扰是莪最后的温柔 提交于 2019-12-24 01:24:11
问题 I am new to this so i will start with the code and after that i will explain. The problem is this [HttpGet, ODataRoute("({key})")] public SingleResult<Employee> GetByKey([FromODataUri] string key) { var result = EmployeesHolder.Employees.Where(id => id.Name == key).AsQueryable(); return SingleResult<Employee>.Create<Employee>(result); } [HttpGet, ODataRoute("({key})")] public SingleResult<Employee> Get([FromODataUri] int key) { var result = EmployeesHolder.Employees.Where(id => id.Id == key)

Prevent null values from being emitted in a WebAPI OData v4 service

假装没事ソ 提交于 2019-12-24 00:22:52
问题 I'm running an WebAPI OData v4 service and I don't want null values to be emitted. For example, when I request a User object, the following is returned: "value": [ { "FirstName": "John", "LastName": "Smith", "EmailAddress": "john@smith.com", "PasswordHash": null, "PhoneNumber": "11234567890", "Website": null, "Id": "dac9706a-8497-404c-bb5a-ca1024cf213b" } Since the PasswordHash and Website fields are null, I'd like them to not be included in the output. I've tried the following lines in the

OData Source Component in SSIS Not Connecting

守給你的承諾、 提交于 2019-12-23 20:25:21
问题 This is a follow-on from a previous question: OData Source Component in SSIS Hanging Setup I'm using SSIS in Visual Studio 2015 (17.4) and would like to pull in the public NADAC data from this page using the OData connection: https://data.medicaid.gov/Drug-Pricing-and-Payment/NADAC-National-Average-Drug-Acquisition-Cost-/a4y5-998d. I've successfully created an OData Source Connection Manager to the base URL: https://data.medicaid.gov/api/odata/v4/ using windows authentication. I've created a

Introduce custom property in OData

半城伤御伤魂 提交于 2019-12-23 17:38:53
问题 In my database User table I have DataTime field called DateDeleted - which is null while user exists and is set to the proper value when user "is deleted". I wonder if there is a way to introduce IsDeleted property for User entity so that http://odata/service.svc/Users(1)/IsDeleted will return true or false depending on whether DateDeleted is set or not My research in google hasn't got any results and I am almost sure it is not possible to implement through odata. Am I right? 回答1: With the

Breeze query error, even though results returned

时光毁灭记忆、已成空白 提交于 2019-12-23 17:36:03
问题 Breeze is calling the "fail()" function, even though the data seems to be returned from the odata service (as well as being in the error object). There are 5 "transactions" returned from the ODATA service (as seen in Chrome developer tools) as well as in the "data" property of the error object being passed to the fail function. Calling code looks like this: function getTransactions() { var query = breeze.EntityQuery.from("Transactions") .take(5); return entityManager.executeQuery(query,

OData $format system query option causes Bad Request 400

半城伤御伤魂 提交于 2019-12-23 13:24:29
问题 I have a very simple Reflection-based OData sample the runs fine and generates json when I use the Accept header as indicated. However, I cannot get it to work with the $format=json parameter. Whenever I add that parameter, I get Bad Request. According to this, it seems like it should work: link text Note that other system query options like $select do work okay. This is .Net 4 running via VS2010. 回答1: Using $format=json out of the box against a .NET 4 WCF Data Service will not work even

Can an OData query specify a filter that references a nested entity?

隐身守侯 提交于 2019-12-23 12:52:43
问题 Here is the setup: I've got a "Student" who has a related entity "Course" (1 to many). Each "Course" has a related entity "Period" that contains all of the time and date details of the course. I want to get back all of the students who have had a course in 2011. I've tried this: ~/Student()?$expand=Course/Period&$filter=Course/Period/Year eq 2011 but it results in an error: No property 'Period' exists in type 'System.Data.Objects.DataClasses.EntityCollection`1[[Course]] Clearly, Period is

Returning child elements in ASP.NET WebAPI OData

╄→尐↘猪︶ㄣ 提交于 2019-12-23 11:48:42
问题 I'm using the latest ASP.Net WebAPI Nightly builds (dated 2013-01-16). I have a simple EF database first model at the moment that has two entities - Patients and Visits. Each patient can have many visits. I'd like to be able to query for my list of patients and have the visits entities for each patient returned inline. I know that WebAPI's OData implementation doesn't yet support $expand. I'm hoping that just means that optional client-controlled expansion is not supported and that I can

Does OData query support nested filters with AND/OR operators?

故事扮演 提交于 2019-12-23 09:20:48
问题 Does OData query support nested filters with AND/OR operators? By nested query, I mean query similar to this: ((FieldA < 50 OR FieldA > 100) AND FieldB == "MyString") I am building an OData query editor control, so I need to know if these are available. Thanks! 回答1: Yes it does. E.g.: GET http://services.odata.org/v4/TripPinServiceRW/People?$filter=(FirstName ne 'Mary' and LastName ne 'White') and UserName ne 'marywhite' You can try it yourself in a browser. 来源: https://stackoverflow.com

How to Link to OData Collection in Razor using ASP.NET MVC Web API OData

一世执手 提交于 2019-12-23 09:11:07
问题 I have an ASP.NET MVC 4 app that i'm incorporating an OData API into. This is running the 2012.2 stuff with the larger OData support. I did not use a separate area for this...that might have been a mistake but my app is small and area seemed overkill. I've got my controllers setup correctly and an example path to my Segments collection (segments is a type in my domain) is "/odata/Segments". This loads as expected and is working. On my homepage i'm trying to add a link to this resource using