odata

How to pass authentication header to OData Service

流过昼夜 提交于 2019-12-22 11:35:04
问题 I am following authentication method described at http://blogs.msdn.com/b/astoriateam/archive/2010/07/21/odata-and-authentication-part-6-custom-basic-authentication.aspx I am able to consume service using ASP.NET (not a problem at all). Now I would like to create a plain HTML page and access the service using "OData Javascript Library" (datajs). If I disable authentication and request for data, it works fine. I could not find any sample code on how to send authentication header information

How to dynamic add filters to a LINQ query against an Odata Source in C#

爱⌒轻易说出口 提交于 2019-12-22 11:09:25
问题 I have a query like the following var query = (from x in NetworkDevices where x.Name == "blabla1" || x.Name == "blabla2" select x ); and i'm running it against an Odata endpoint, so it effectively gets translated into the following URL https://targetserver/endpoint.svc/NetworkDevices()?$filter=Name eq 'blabla1' or Name eq 'blabla2' So i want to dynamically add lots of those where filters... In C# i can just keep adding it to my query, but that isn't dynamic. I want to do it at runtime. If i

Azure Logic App SQL ODATA Filter on Date

梦想的初衷 提交于 2019-12-22 11:08:06
问题 I'm creating a new Logic App that reads a table where DateCreated < ADDDAYS(-60,GETDATE()) and updates an Archived bit to 1 . However, I can't for the life of me figure out how to implement that filter as part of the ODATA query. Here's what I'm trying so far: DateCreated lt addDays(utcNow(),-60) However, I get "An unknown function with name 'utcnow' was found. This may also be a function import or a key lookup on a navigation property, which is not allowed.\r\n inner exception: An unknown

404 Error when calling for the metadata using WEB API OData v4

不羁的心 提交于 2019-12-22 10:44:00
问题 I have tested the the call to the $metadata using postman and have found that when the MaxDataServiceVersion header is supplied the service always returns a 404 error. I have other posts about this using Breeze, but the best answer I can find simply says to comment out the line that adds this header. We are using SAPUI5 ODataModel in our client application and commenting out that header is not an option. Web API Config: ODataConventionModelBuilder builder = new ODataConventionModelBuilder();

How to generate valid metadata from EF DBContext via EdmBuilder for OData v3/BreezeJS

我与影子孤独终老i 提交于 2019-12-22 10:37:13
问题 I'm trying to write an OData v3 Backend for use in an .NET4 application. I want to use BreezeJS on the client side. For the server/OData implementation I use ODataLib v1-3. In order to generate metadata for an existing model I followed the guidelines here: http://www.getbreezenow.com/documentation/ef-design-tool (more specifically the part "The metadata-only DbContext") which describes how to use the Entity Framework as a design time tool to generate a IEdmModel and Metadata. I use the

Include related entities with WebAPI OData request

旧时模样 提交于 2019-12-22 10:08:25
问题 Is there any way to include related entities in an OData request? For example, I have a Person entity and a Task entity. The relationship is one-to-many, with a Person having many Tasks. If I query the data with the OData request: /odata/Person to get all the Person entities, the json returned does not include a Tasks property for each Person. However, if I query the data with the OData request: /odata/Person(14)/Tasks I get the collection of Tasks that belong to that Person. What I'm hoping

Simple - React and OData

我的梦境 提交于 2019-12-22 09:55:06
问题 I'm completely new to React and having a hard time understanding it. I've been tasked with creating a really simple API fetch to an OData endpoint. Now, I've come across this library https://www.npmjs.com/package/react-odata Which looks fantastic! However I just do not understand how to even get something like this working. I understand the very basic principles of how react works and have gone through many basic tutorials. But for whatever reason I can not get my head around this one. So how

Web API OData $expand doesn't return complex types

戏子无情 提交于 2019-12-22 09:02:12
问题 Domain model: public class Course { public int CourseId { get; set; } public virtual ICollection<TeeSet> TeeSets { get; set; } } public class TeeSet { public int TeeSetId { get; set; } public int CourseId { get; set; } public CourseRating MensRating { get; set; } } The following query does not include the CourseRating complex type when Courses are expanded to include TeeSets. GET /api/courses?$expand=TeeSets public class CoursesController : ApiController { [Queryable] public IQueryable<Course

Web API OData $expand doesn't return complex types

为君一笑 提交于 2019-12-22 09:00:04
问题 Domain model: public class Course { public int CourseId { get; set; } public virtual ICollection<TeeSet> TeeSets { get; set; } } public class TeeSet { public int TeeSetId { get; set; } public int CourseId { get; set; } public CourseRating MensRating { get; set; } } The following query does not include the CourseRating complex type when Courses are expanded to include TeeSets. GET /api/courses?$expand=TeeSets public class CoursesController : ApiController { [Queryable] public IQueryable<Course

web api odata: $select not working

雨燕双飞 提交于 2019-12-22 08:57:45
问题 Trying to get this to work. The query returns all rows even though I am specifying only one (?$select=title). On the webapiconfig I have: var queryAttribute = new QueryableAttribute() { AllowedQueryOptions = AllowedQueryOptions.All }; config.EnableQuerySupport(queryAttribute); The controller looks like this: public override IQueryable<_person_TITLE> Get() { return db.personTitle.AsQueryable(); } protected override _person_TITLE GetEntityByKey(int key) { return db.personTitle.FirstOrDefault(p