Questions tagged [odata]

1

votes
0

answer
129

Views

How to perform a LINQ join on IQueryable<T> in odata controller

I have a WebAPI method which uses the OData Query Options to return data to the client. The entity has cityid and I want cityname from another entity using joins. I have tried using below Api method, which is incomplete. Entity1:- public partial class UU_DeliveryCharges { public int DeliveryChargeId...
Sunil Chaudhary
1

votes
0

answer
80

Views

Asp.NET api with Odata [NotMapped] not working

I have restful api using ASP.NEt with Odata. I tried to add a new property (that is not in database) to the model , when I run the server the result I get are correct but the property I added is not shown in JSON. I tried to add everything like : [DataMember] [JsonProperty] and I have also [NotMappe...
Noah13
1

votes
0

answer
253

Views

How to ?$filter data using OData through WebAPI (PHP / cURL)

I'm GETing data in JSON through a WebAPI by sending cURL requests to the server - basically works. Problem starts when I'm trying to filter for a field in (sorry, layman's terms) the 2nd layer of the JSON data. Here's some example JSON data: { 'id': 'SOMEHASH', 'name': 'OPP-Name', 'actualCloseDate':...
thom_stackoverflow
1

votes
0

answer
143

Views

OData V4 attribute routing not using the right action

i am experiencing a problem with attribute routing in OData V4. I have a simple Customers model class and a Controller, which has 2 Get methods. However, whenever i try to GET a specific Customer like /Customers(7) , it always uses the second Get method to get all customers, but never breaks into th...
Peter
1

votes
0

answer
87

Views

Error OData Source SQL Server 2016

I'm using SQL Server 2016 with SharePoint 2013. I'm trying to access to SharePoint List. I use the OData Source in my Package. The connection works succefully and I can preview (with the Preview button) data from the list. But, when I try to execute it got an error : Error: La connexion « Connexi...
Sara
1

votes
1

answer
266

Views

Job failure on OData - OData source was unable to process the data

I have a SSIS package which pulls data from OData source and stores it in database at local server. This package runs perfectly at a scheduled time daily but sometimes the package execution fails and i get the job failure notification. The error comes as 'OData source was unable to process the data...
mrityunjay kumar
1

votes
1

answer
344

Views

Building OData EF Model with dynamic data structure

is it possible to create an EF model on the base of a dynamic structure? F.e. i have a Customer, which can have custom fields defined by the administrator of the system. Based on that the customer related custom fields table, is being altered and a new column is added for the new defined field. Is...
Peter
1

votes
0

answer
1.2k

Views

Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IActionSelectorDecisionTreeProvider' from assembly 'Microsoft.AspNetCore.Mvc.Core

I'm developing an OData ASP Net Core API. This is the part of the code that i have troubles: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { //Adding Model class to OData var builder = new ODataConventionModelBuilder(); builder.EntitySet(nameof(CustomEntity)); //Enabling OD...
lsalvatore
1

votes
0

answer
104

Views

How to increase recursion depth in OData?

I have a case with ASP.NET Web API OData that is regarding a too deep query filter. The $filter is a nested query with too many parenthesis. It is generated by a third party tool that we have no control on it. First parts of this query is like followings: $filter=((((((((((((((((((((((((((((((((((((...
Afshar Mohebbi
1

votes
0

answer
216

Views

Add to odata collection property in .NET

Using the odata-v4 service connection in visual studio C# .NET, I get an entity of type testDefinition. testDefinition has property called features which is a collection of entities of type feature. In the DB, testDefinition to feature is many to many with a junction table. In my code, I add a servi...
Matt
1

votes
0

answer
50

Views

Response from OData API in .NetCore is well formed?

I have this function code made in a controller CustomEntityController of a CustomEntity Model from OData API public HttpResponseMessage Post([FromBody] CustomEntity entity) { HttpResponseMessage response = null; SecurityController sc = new SecurityController(); // if (sc.CheckPermission(User.Identit...
lsalvatore
1

votes
1

answer
39

Views

Error in OData GET returns 406/404 with multiple parameters in different cases

I have been trying executing a get method with multiple parameters but sometime result is 404 or else if it finds the method then 406(Not Acceptable). It is working with single params. CASE 1: Single Params -> Working returns string Request url - http://localhost/odata/Monitoring/GetTestingDone(num...
Ankur Rai
1

votes
0

answer
383

Views

Asp.Net Web Api — OData Query => ComosDb Query

I'm building an Asp.Net Web API, which I plan to have conform to ODATA query standard, and backed by Cosmos Db. Lets looks at a generic workflow I'm looking for help solving: Model: Vehicle { public int NoWheels {get;set;} public string Type {get;set;} } ODATA Query: /api/Vehicle?$filter=NoWheels+eq...
David.Jones
1

votes
0

answer
58

Views

OData function parameter type double

I've created an function that have as parameter int, int, double: var functionUnitConvertDouble = builder.Function('Convert'); functionUnitConvertDouble.Parameter('From'); functionUnitConvertDouble.Parameter('To'); functionUnitConvertDouble.Parameter('Value'); functionUnitConvertDouble.Returns(); an...
Nicolas B
1

votes
0

answer
269

Views

Is it possible to config multiple routes with ODATA

I've created a project containing both MVC and WebAPI. There's a MVC controller named HomeController which containing only one action named Index. Also, there's a API controller named ValuesController. Everything works fine without OData, I can access to both http://localhost/Home/Index and http:/...
Charlie
1

votes
1

answer
61

Views

UWP - need sample how to consume OData service

Can anybody please explain how to get data from a table and related table with OData ConnectedService, in UWP application? I have this code in my ViewModel: public async Task LoadData() { bool returnValue = false; this.OrderTypeCollection = new ObservableCollection(); this.OrderSelectedItem = new Or...
Alexey Titov
1

votes
0

answer
82

Views

SSIS ingestion from SharePoint with oData broken - Internal Server Error 500

I have SSIS packages that use the oData data source to pull data directly from SharePoint lists and libraries into SQL Server. The packages worked before I left my civilian job on military leave, and now they don't. The only thing that's different is that the following list of patches have been ins...
J.D. Walker
1

votes
0

answer
43

Views

Web API ODATA - Does we have to load all the records to enable filtering using Odata?

I am developing an API using ASP.Net WEB API + Odata to query and filter those data. But rather than using entity framework to retrieve data,i am using ADO.Net to get data from Stored Procedures. Its working fine but to apply Odata filtering first i have to retrieve all the records from the databas...
Trigga
1

votes
1

answer
47

Views

odata webapi routing issue: get method with identifier not matched

I am new to OData. For learning purposes (guided by this tutorial), I have set up a sample WebApi like the following (Only pasting what I consider relevant). Configuration: using DataApi.Models; using Microsoft.OData.Edm; using System.Net.Http.Headers; using System.Web.Http; using System.Web.OData.B...
1

votes
0

answer
171

Views

.NET Odata 7.2 > dynamic IEdmModel using dependency injection

Build a dynamic odata endpoint using .NET oData 7.2. I am injecting the IEdmModel using a DI per scope request for each request - so that my dynamic endpoint can change Model per URL i.e. /odata/modela/$metadata and /odata/modelb/$metadata returns two different models. Inspiration came from https://...
Cloudcodr
1

votes
1

answer
234

Views

How to get the enum value instead of enum name in OData v4?

I have an enum that looks like this: enum Color : byte { Transparent, White, Black } When I request the values from my Entity I get the results as strings, not integers, example: { 'Color': 'White' } Is there any way to make OData return the value instead of the name of the value? I'm using Microsof...
Emerson Jair
1

votes
0

answer
39

Views

Select non null value column from two columns in odata query

I am joining two tables like: SELECT * FROM Student s JOIN Department d ON d.StudentId = s.StudentId WHERE s.studentname = 'John' But sometimes there is null value in StudentId column of the Student table. In that case I have to join with StudentSubId column. In SQL we can use COALESCE like this:...
csharpnew720
1

votes
0

answer
21

Views

Unable to fetch odata request parameter and values

I have a webapi 2 project. I am making below calls to fetch parameter and values specified but RouteData is empty. var routeData = HttpContext.Current.Request.RequestContext.RouteData; var id = routeData.Values['contextId'] as string; This is the url : http://localhost:29016/api/v1/Contexts(1)/Appli...
Usman Khan
1

votes
0

answer
271

Views

Odata - collection filter with contains

Hello I would like to filter in this structure: class User{ public ICollection Roles{get; set} } class Role{ public string Permissions{get; set;} //'User, Admin, Editor' } I would like to find users by permission. I tried this: /odata/Users/?$filter=Roles/any(r: contains(r/Permissions, 'Admin')) Her...
bluray
1

votes
0

answer
14

Views

Getting edmmodel from Request in asp.net odata web api version 6(latest version)?

Is there anyway i can get edmmodel from Request in asp.net odata web api version 6? Thanks
rbmanian75
1

votes
1

answer
66

Views

SSIS package cannot pull from one SharePoint list, all others are okay. Where do I start?

I have SSIS packages that use the oData source to pull from SharePoint lists and libraries. Most of them work. One of them does not. The connection tests fine, but when I go to edit the data source and specify the list I want, trying to retrieve the columns gives me an error that says 'An error o...
J.D. Walker
1

votes
0

answer
294

Views

SAP Cloud Platform. Fiori Mobile Hybrid Application : Offlne oDATA documentaton?

I'm struggling to find any clear or coherent documentation on implementing offline oData through SCP Fiori Mobile. The best info I've came across has been to add the following to Manifest.json here : https://blogs.sap.com/2017/03/22/make-offline-app-using-sap-cp-mobile-service-for-sap-fiori-part-1/...
Adam Harkus
1

votes
1

answer
116

Views

How to configure WEB API in C# with Odata v4 to receive more than one POST em same Controller

I have a WEB API project in C# that uses Odata V4, and I need a controller with more than one POST. How to configure? When i call my rest in postman, i have an error: 'No non-OData HTTP route registered'. Here's my Controller code: [Authorize] [ODataRoutePrefix('student')] public class StudentCont...
Userssp
1

votes
0

answer
277

Views

Format of an ODATA filter specifying an enum

I have built an EdmModel which contains an enum property, Level. var level = new EdmEnumType('Log.Api.Models', 'Level', EdmPrimitiveTypeKind.Int32, false); level.AddMember(new EdmEnumMember(level, 'Debug', new EdmIntegerConstant(0))); level.AddMember(new EdmEnumMember(level, 'Error', new EdmIntegerC...
awj
1

votes
1

answer
40

Views

Excel Power Query duplicate OData Requests

I am using Power Query to get data from one of the OData services for reporting purposes. It seemed really easy till I found out, that it does 3 or 4 OData GET-requests every time I update the report. This is not acceptable for me due to performance issues. I tried it with and without parameters in...
NJW
1

votes
0

answer
258

Views

Apply [EnableQuery] attribute of OData Globally in ASP.NET Core

In ASP.NET I'm able to Enable Query support Globally using following lines of code. public static void Register(HttpConfiguration config) { config.EnableQuerySupport(); } OData recently reliesed their beta2 version of AspNetCore.OData. Using which we can enable query support at action level using [E...
Dev05
1

votes
0

answer
70

Views

How to return IQueryable result after joining 2 entities in oData controller

I have two tables UU_DeliveryCharges and SC_Countries and I want to return result set as a join of these two in my odata function but getting an exception: The entity or complex type 'ULYXModel.UU_DeliveryCharges' cannot be constructed in a LINQ to Entities query. I am new in oData, please help. oDa...
Mona
1

votes
0

answer
108

Views

How can I build a OData client based on a shared model (POCO classes)?

In my project I am using OData v3 and v4 (ASP.NET Web API with Entity Framework in the back). Currently I builded a client using the Visual Studio tools. But is there another way? Do I really have to build a client based on the $metadata and the toolset? Is it possible to share my model (contract) b...
rittergig
1

votes
1

answer
45

Views

Run Query on Dynamics CRM from Sharepoint Page using ODATA in JavaScript

I am trying to query CRM from a SharePoint page. I use this to get the user's full name: ctx = new SP.ClientContext.get_current(); var web = ctx.get_web(); web.get_currentUser(); This would give me 'Surname, Forename', then I use a substring function change this to 'Forename Surname' I then create a...
Jason James
1

votes
0

answer
167

Views

Query format for Guid filtering with OData Adaptor

We have bound a table column with Guid field using ODataV4Adaptor. While filtering this field, the query is passed as shown below http://localhost:49339/odata/Orders/?$count=allpages&$filter=Id%20eq%20guid%27a972c577-dfb0-064e-1189-0154c99310db%27&$skip=0&$top=12 When the query is passed we receive...
keerthana
1

votes
1

answer
121

Views

How to set the return value of MS Fakes object?

I have generated an OData Client code with the OData V4 Client Code Generator. The generated code cannot be unit tested without MS Fakes so I generated a fake assembly from it. Now I have a problem of how to actually set the return value of the methods. The 'core' class in the generated code is call...
kor_
1

votes
0

answer
150

Views

OData Error Response missing exception detail C#

I have C# WebApi2 project running on my localhost machine, if a OData error occurs, i receive the error in the following format https://localhost:44379/api/v2/events?$filter=1 { 'error': { 'code': '', 'message': 'The $filter expression must evaluate to a single boolean value.', 'innererror': { 'mess...
gorillapower
1

votes
0

answer
221

Views

How to add SAP HANA:View with Input-Parameter to SmartTable XML SAPUI5

I'm trying to add a view Entity Set to a Smart table in XML but the Entityset got an Input parameter. 'MYAPP.CalculationViews::FIVELEVELANALYSE' as 'FIVELEVELANALYSE' key generate local 'EMP_ID' parameters via entity '5LevelSYS' results property 'Execute'; I can use 5LevelSYS(1)/Execute to get the c...
Heer
0

votes
1

answer
16

Views

Projecting an IEnumerable inside an Projected IQueryable making N Requests to the Database

I'm making an Asp.net Core Api and one of the Actions of the Controller i need to return an IQueryable of a DTO, but one of the properties is an IEnumerable of another DTO in a relationship one to many in the database model of EF. For example: public class Customer { public int Id { get; set; } publ...
miguelkmarques
1

votes
1

answer
211

Views

How to use ODataQueryOpions with lower Camel case?

I am using the latest Microsoft.AspNetCore.OData (7.0.0-beta2). I am trying to use ODataQueryOptions to get OData parameters from the OData query with Camel case properties names. I have used builder.EnableLowerCamelCase(); Everything is working fine when calling my controller endpoints with Pascal...
Aloene

View additional questions