odata

WCF Data Services: How to avoid the __metadata members

有些话、适合烂在心里 提交于 2019-12-19 07:39:37
问题 I'm currently experimenting with using WCF Data Services as a way to open up our product a bit more while at the same time being able to consume the data from AJAX. One thing that I noticed is that the JSON represention format has these __metada members sprinkled across the data, and in the OData documentation I found this (under Representing Entries): An optional "__metadata" name/value pair is the only pair that should be included on the object that does not directly represent a Property of

oData $expand on Derived Types

大憨熊 提交于 2019-12-19 04:48:09
问题 I am having challenges with odata query to get derived type: {{Url}}/odata/resource?$expand=derivedType See this link which gives options like ~/People/OfType('Employee')(41)/Manager or ~/People!Employee which didn't work. Is this supported with Asp.Net Web Api 2 with EF6? What would be the query? 回答1: This is an exerpt from OData 4.0 convention docs: Any resource path or path expression identifying a collection of entities or complex type instances can be appended with a path segment

How can I manually execute Breeze filters in Web Api?

大城市里の小女人 提交于 2019-12-19 04:06:45
问题 I want to use some external server-side logic to modify properties on the results of a query. To do this, I'll need to apply the Breeze query options, modify the result set, and return it. I know essentially how I can apply OdataQueryOptions to my query, but I don't want to miss out on all the things that BreezeJS does that Web Api's OData doesn't. For example, I want to keep inlineCount . How can I do this? Is there some way to hook into Breeze's query modifying code? In case it matters, I'm

How to Instantiate ODataQueryOptions

谁都会走 提交于 2019-12-19 03:41:23
问题 I have a working (simplified) ODataController with the following method. public class MyTypeController : ODataController { [HttpGet] [EnableQuery] [ODataRoute("myTypes")] public IQueryable<MyType> GetMyTypes(ODataQueryOptions<MyType> options) { return _repo.myResultsAsQueryable(); } } I would like to be able to call this method from the server and to do this I need to instantiate an ODataQueryOptions which requires an ODataQueryContext . There are examples of how to do this (Eg. here and here

Controlling what is returned with an $expand request

孤街醉人 提交于 2019-12-18 15:46:13
问题 So, using the ODataController , you get to control what gets returned if somebody does /odata/Foos(42)/Bars , because you'll be called on the FoosController like so: public IQueryable<Bar> GetBars([FromODataUri] int key) { } But what if you want to control what gets returned when somebody does /odata/Foos?$expand=Bars ? How do you deal with that? It triggers this method: public IQueryable<Foo> GetFoos() { } And I assume it just does an .Include("Bars") on the IQueryable<Foo> that you return,

SAP Fiori - OData and Gateway

旧城冷巷雨未停 提交于 2019-12-18 15:11:07
end of metadata Created by Masayuki Sekihara , last modified by Jeremy Good on Dec 30, 2016 Go to start of metadata This is a collaborative document to share lessons learned contents for OData and Gateway in the community SAP Fiori . Please feel free to insert the link of your document or blog by selecting the edit button from Actions. You can also search information and open a discussion if you can't find required information. Please don't forget to put the tag fiori. Understanding runtime OData behavior helps for your troubleshooting. You do not need to understand full Gateway functions and

How do I update an OData entity and modify its navigation properties in one request?

跟風遠走 提交于 2019-12-18 13:22:37
问题 I am trying to implement what I thought was a simple scenario using an OData service provided by WCF Data services (using the OData V3 application/json;odata=verbose payload format, for now. I may use the JSON Light format in the future). The basic scenario goes like this: I have two entities: class Person { public int ID { get; set; } public string Name { get; set; } public virtual PersonCategory Category { get; set; } } class PersonCategory { public int ID { get; set; } public string

OData: Date “Greater Than” filter

Deadly 提交于 2019-12-18 11:07:21
问题 Is there a way to return a series of records in OData by specifying a "Date greater than xxxxx" filter...but using a Date that was previously obtained form an OData feed? Use Case: Pretend that I want to build a web page that displays a list of the most recently completed online orders. This is what I'm aiming for: Load the page Hit my OData service asynchronously, returning the last 100 orders (ordering by date descending so that the most recently completed order shows up first) Build the

OData Error: The query specified in the URI is not valid. The property cannot be used in the query option

主宰稳场 提交于 2019-12-18 10:49:13
问题 I'm trying to get an OData endpoint up and working and I'm having this error that even Google doesn't have much to say about. I have created an Entity Framework EDMX context (database first), had the designer generate 2 models from it. Everything is working fine, except $filter queries fail. I can do this fine: http://localhost:27164/Projects(6587660) Which retrieves the Project with a primary ID of 6587660. But any $filter requests as such: http://localhost:27164/Projects?$filter=ProjectID

How to consume OData service with Html/Javascript?

坚强是说给别人听的谎言 提交于 2019-12-18 10:41:26
问题 Our project currently uses Silverlight to consume an Odata service. This has made life pretty simple since we can just reference the OData service thus giving us generated service reference/entities. However there is some discussion on whether we should move to Html (html5). I'd like to know what to expect if we make this change. We'd be leveraging a framework like jQuery of course. My main concern is how to consume the same OData service via JavaScript/jQuery. How are we suppose to