odata

WebApi OData v4 ComlexType cannot have an EntityType

社会主义新天地 提交于 2020-01-23 11:21:06
问题 We were using WebApi OData v 3 and had a couple ComplexType entities defined in the entity data model that contained EntitySet entities. When moving to OData v 4 and upon doing the modelBulder.GetEdmModel() step we get an InvalidOperationException "The complex type 'Foo' refers to the entity 'Bar' through the property 'Bar'." I look at the spec and see a thing called an "abstract entity type" that is a type that holds entity types. I don't see that in the WebApi OData code so I hope that all

How do I map an OData query against a DTO to an EF entity?

纵然是瞬间 提交于 2020-01-22 19:02:05
问题 I have an ODataController in an Asp.Net Web Api application that allows OData queries. I'm only allowing reads, not updates. Instead of exposing the data model directly, I've created a set of DTOs. The property names on the DTOs do not necessarily match the properties on the EF model. This causes a problem when I try to use the OData query against the EF model. I've looked at other posts on StackOverflow around this subject but none of them seemed to resolve this issue. Here is what I have

Why doesn't my oData response have navigation properties

只谈情不闲聊 提交于 2020-01-22 15:41:25
问题 If you look at the following sample oData feed you'll see included navigation properties for 'child' items to tell you which URL to follow: http://services.odata.org/OData/OData.svc/Suppliers?$format=json For example supplier 0 has a navigation property to products. This links to a list of products for that supplier. http://services.odata.org/OData/OData.svc/Suppliers(0)/Products?$format=json I'm trying to do the same with ODataConventionModelBuilder and EntitySetController<Product> so that

SAP OData service的执行是如何从Gateway系统转交到backend系统

拈花ヽ惹草 提交于 2020-01-21 00:11:06
下面是我今天研究的后台OData数据的model以及如何在IE里面consume: SPRO里面: 这个model provider class定义了LWM_CUSTOMER_BRIEFING这个model的所有structure,以及structure之间的相互关系。 现在没有一个图形化界面的tool来做modelling,我们只能在CL_LWM_CB_ADAPTER_MDP的DEFINE里面定义model的structure。具体做法是预先定义好后台要使用的entity的data type, Customer briefing 所有使用到的DDIC object全部放在这个package里面:LWM_CRM_CUSTOMER_BRIEFING 在DEFINE里面,通过ABAP 代码创建一个个entity,给它们绑上DDIC object,同时建立相互关系,如association. 通过http://ldcigm2.herr.corp:50018/sap/opu/sdata/sap/customer_briefing?sap-client=001 我们可以拿到customer briefing的service document。 Service document里面只定义了哪些entity暴露了哪些操作,真正metadata的full definition xml用这个URL

Web API OData Inlinecount not working

a 夏天 提交于 2020-01-19 04:48:05
问题 I am using the out of the box ValuesController in a ASP.NET Web API application public class ValuesController : ApiController { // GET api/values [Queryable(PageSize = 1)] public IQueryable<string> Get() { return new string[] { "value1", "value2", "value3", "value4", "value5" }.AsQueryable(); } } When I get http://localhost/api/values?$inlinecount=allpages This is the response <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Web API OData Inlinecount not working

一笑奈何 提交于 2020-01-19 04:48:05
问题 I am using the out of the box ValuesController in a ASP.NET Web API application public class ValuesController : ApiController { // GET api/values [Queryable(PageSize = 1)] public IQueryable<string> Get() { return new string[] { "value1", "value2", "value3", "value4", "value5" }.AsQueryable(); } } When I get http://localhost/api/values?$inlinecount=allpages This is the response <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

RESTier OData Function returning EntitySet. “The related entity set could not be found from the OData path”

家住魔仙堡 提交于 2020-01-17 12:25:10
问题 Added a function on RESTier OData var ambilLocationsByMarketId = new EdmAction(ns, "AmbilLocationsByMarketId", location.GetEdmTypeReference(true), false, null); model.AddElement(ambilLocationsByMarketId); var entityContainer = (EdmEntityContainer)model.EntityContainer; entityContainer.AddActionImport("AmbilLocationsByMarketId", ambilLocationsByMarketId); Implemented the custom function in my DomainController [HttpGet] [EnableQuery] [ODataRoute("AmbilLocationsByMarketId")] public

RESTier OData Function returning EntitySet. “The related entity set could not be found from the OData path”

旧巷老猫 提交于 2020-01-17 12:24:08
问题 Added a function on RESTier OData var ambilLocationsByMarketId = new EdmAction(ns, "AmbilLocationsByMarketId", location.GetEdmTypeReference(true), false, null); model.AddElement(ambilLocationsByMarketId); var entityContainer = (EdmEntityContainer)model.EntityContainer; entityContainer.AddActionImport("AmbilLocationsByMarketId", ambilLocationsByMarketId); Implemented the custom function in my DomainController [HttpGet] [EnableQuery] [ODataRoute("AmbilLocationsByMarketId")] public

Can I customize the .NET linq provider's translation to oData URI format?

好久不见. 提交于 2020-01-17 01:12:11
问题 background: This LINQ query in Linqpad (or in VS2010 for that matter) EntityTypes.Where(x => x.EntityUrn == "http://foo") translates to the following oData compliant URI: http://localhost/OData.svc/EntityTypes('http://foo') (this is because the EntityUrn is the entity key...if my Linq query specifies any other field, the $filter syntax is used instead) The problem is that this oData URI returns an error due to restricted characters in the Entity Key (see blogs.msdn.com/b/peter_qian/archive

401 Unauthorized with OData Update and Delete

我是研究僧i 提交于 2020-01-16 19:24:25
问题 For the first time I have stumbled upon a problem where the solution has not already been provided (completely) on SO, but I hope someone out there can help. My problem is similar to PUT and DELETE in RESTful WCF Service cause 401 Unauthorized error . That is, I have a WCF Data Service where I get a 401 whenever I try to do updates or deletes (read and post works without any problems). The difference to the abovementioned post is that I am not hosting my service in IIS but on Windows Azure,