odata

OData returns internal server error (500) when calling a controller that not exists - on iis

霸气de小男生 提交于 2021-01-05 06:41:14
问题 when calling for example http://localhost/odata/test - (no TestController implemented), Odata return internal server error instead of 404 (Not Found). What can I do? 回答1: Confirm the path="*." in the web.config file (inside <system.webServer> <handlers> ) <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/> 来源: https://stackoverflow.com/questions/46884389/odata-returns

How to take OData Queryable Web API endpoint filter and map it from DTO object?

爷,独闯天下 提交于 2021-01-04 03:12:40
问题 I have a simple Web API endpoint which can accept incoming OData queries: public IActionResult GetProducts(ODataQueryOptions<ProductDTO> options) { var results = DomainLayer.GetProducts(options); return Ok(results); } I specifically want to be able to query against ProductDTO objects and to be able to filter or sort against the properties of the DTO representation. My design issue is that I want to take advantage of the filter parsing/applying logic of the OData library but I don't want to

How to take OData Queryable Web API endpoint filter and map it from DTO object?

跟風遠走 提交于 2021-01-04 03:07:12
问题 I have a simple Web API endpoint which can accept incoming OData queries: public IActionResult GetProducts(ODataQueryOptions<ProductDTO> options) { var results = DomainLayer.GetProducts(options); return Ok(results); } I specifically want to be able to query against ProductDTO objects and to be able to filter or sort against the properties of the DTO representation. My design issue is that I want to take advantage of the filter parsing/applying logic of the OData library but I don't want to

Get optionset text from OData query in CRM web api

感情迁移 提交于 2021-01-02 13:22:53
问题 https://example.com/crm/api/data/v8.2/accounts?$select=custom_optionset The above query selects all values in an optionset field in CRM. The return data looks something like this: { { "@odata.etag":"W/\"112607639\"","custom_optionset":285960000,"accountid":"a08f0bd1-e2c4-e111-8c9a-00155d0aa573" }, { "@odata.etag":"W/\"112615384\"","custom_optionset":285960010,"accountid":"a18f0bd1-e2c4-e111-8c9a-00155d0aa573" } } I don't want the value of the optionset. I want the associated text label. How

Strong-typed Linq to construct OData query options

荒凉一梦 提交于 2021-01-01 07:41:31
问题 Assume the following example that demonstrates how to perform read operation using HttpClient: using (var client = new HttpClient()) { client.BaseAddress = webUri; client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var requestUrl = "/api/products?$filter=(Category eq 'Cars')"; var response = await client.GetAsync(requestUrl); if (response.IsSuccessStatusCode) { var products = await response.Content

How do I replace the OData V4 default Json Serializer with NewtonSoft's Json Serializer?

时光毁灭记忆、已成空白 提交于 2020-12-29 04:07:09
问题 I have a class that contains a List of DynamicObjects. I have a unit test that confirms that the Newtonsoft Json Serializer/Deserializer handles this correctly. However, the default OData Json Serializer/Deserializer does not. I implemented my own ODataEdmTypeDeserializer like this: public class JsonODataEdmTypeDeserializer : ODataEdmTypeDeserializer { public JsonODataEdmTypeDeserializer(ODataPayloadKind payloadKind) : base(payloadKind) { } public JsonODataEdmTypeDeserializer(ODataPayloadKind

How do I replace the OData V4 default Json Serializer with NewtonSoft's Json Serializer?

落花浮王杯 提交于 2020-12-29 04:06:31
问题 I have a class that contains a List of DynamicObjects. I have a unit test that confirms that the Newtonsoft Json Serializer/Deserializer handles this correctly. However, the default OData Json Serializer/Deserializer does not. I implemented my own ODataEdmTypeDeserializer like this: public class JsonODataEdmTypeDeserializer : ODataEdmTypeDeserializer { public JsonODataEdmTypeDeserializer(ODataPayloadKind payloadKind) : base(payloadKind) { } public JsonODataEdmTypeDeserializer(ODataPayloadKind

2.3 基于FPGA的UART协议实现(二)简单UART传输FPGA实现

浪子不回头ぞ 提交于 2020-12-29 02:31:44
      图2 34 FPGA发送一帧串口数据(考虑波特率)   如果图2 34考虑 115200 的波特率,结果如图2 34所示,每一位数据都保持 434 个时钟,为此 Verilog 可以这样表示,如代码2 11所示:           代码2 11 1. reg [10:0]D1; 2. reg [8:0]C1; 3. always @( posedge CLOCK) 4. case( i) 5. 0,1,2,3,4,5,6,7,8,9,10: 6. if( C1 == 9’ d434 -1 ) begin C1 <= 9’ d0; i <= i + 1’ b1; endelse begin TXD <= D1[i]; C1 <= C1 + 1'b1; end 7. ...... 8. endcase   如代码2 11所示,步骤 1~8 不再保持一个时钟,换之每个步骤都保持 434 个时钟,因此每位 TXD 的发送数据也保持 8.68us。   除此此外,串口传输协议不仅可以自定义波特率,串口传输协议也可以自定义一帧数据的位宽,自定义内容如表2 8所示:        表2 8 自定义一帧数据   如表2 8所示,可以自定义的数据其中便包含数据位,默认下为 1 字节,自定义内容则是 5~9 位,校验位也可以设置为有或者无( 默认下是有),停止位也可以增至 2 位

What is Swagger and does it relate to OData?

痞子三分冷 提交于 2020-12-27 12:24:49
问题 I am familiar with the Microsoft stack. I am using OData for some of my restful services. Recently I came across Swagger for API documentation and I am trying to understand how it relates to OData. Both of them seem to be RESTful specifications. Which one is widely used? 回答1: Swagger is a specification for documenting APIs . By creating a swagger document for your API, you can pass it to an instance of Swagger UI, which renders the document in a neat, readable format and provides tooling to

CRM系统的查找字段控件的过滤

耗尽温柔 提交于 2020-12-24 13:46:48
CRM如何过滤查找类型的控件 1.项目场景: 提示:在crm系统中过滤查找类型的控件 # 2.问题描述: :在一次做项目是发现查找类型的控件过滤在每次过滤时只是在原有的基础上过滤 而不是清空原有的过滤 使用当前的过滤:我原本是这样写的 setEntityOrzOrOffice(entityName: string, isSetFirstValue = false) { if (ent.type !== 1) return // 查找多对多关系 var odata = $select=${entityName}id&$filter=systemuserid eq ${util.trimID(ent.getUserId())} service.retrieveSync( new_systemuser_${entityName}set , odata, (data: any) => { console.log(data) if (data && data.value && data.value.length > 0) { if (data.value.length > 1) { // 需要赋值第一个时 this.setOrzOrOfficeValue(isSetFirstValue, data, entityName, false) // 多个则查找过滤 var ids = data