Questions tagged [asp.net-web-api-odata]

ASP.NET 4.x Implementation of OData Services that supports both v3-v4 of the OData Protocol. DO NOT use this tag for [asp.net-core] related questions! Use this tag if your question directly relates to the ASP.NET server-side implementation of OData services, but also include the version specific tag [odata-v3] or [odata-v4]. Only include the non-specific [odata] tag if the question has broader client-side implications.

The ASP.NET Web API OData package offers support for the OData protocol in ASP.NET Web API.

OData is a standard protocol for creating and consuming data. The purpose of OData is to provide a protocol that is based on Representational State Transfer (REST) for create, read, update, and delete (CRUD) operations. OData applies web technologies such as HTTP and JavaScript Object Notation (JSON) to provide unified convention based access to information from various programs. OData provides the following benefits:

  • It lets developers interact with data by using RESTful web services.
  • It provides a simple and uniform way to share data in a discoverable manner.
  • It enables broad integration across products.
  • It enables integration by using the HTTP protocol stack.

Two key defining features of OData over traditional RESTful APIs are the URL conventions that make it possible to compose queries that request only the specific fields and navigation links from resources that are needed on the client as well as the ability to partially update resources using the PATCH HTTP verb.

  • Together these features allow individual clients to reduce the data sent across the wire without needing changes in the API or data schema to support this.

ASP.NET Web API supports both Version 3 and Version 4 of the OData protocol.
Learn more about ASP.NET Web API OData on MSDN

The code from this package to implement this protocol makes heavy use of Language Integrated Query (LINQ) expressions to support deferred execution of client requests, in a sense the ODataLib translates a specific set of URL queries into LINQ queries.

While not required, the ASP.NET implementation has extensive support for using Entity-Framework to access the data layer, reducing the code necessary to expose EF data schemas as OData resources. For this reason Posts on SO related to this tag will often include EF references and concepts.

You can also find more information on:

134 questions
0
votes
1 answer

Is there a way to prevent addition of default ODataMediaTypeFormatters to configuration?

I am trying to customise the behaviour of the standard ODataMediaTypeFormatters and have done so by wrapping them in another type which extends MediaTypeFormatter. e.g. var formatters = ODataMediaTypeFormatters …
Mark Watts
  • 724
  • 7
  • 15
0
votes
1 answer

confused between Api Controller and oData Controller to use with angular's ngresource

i have an angular application that calls web api . it was working all fine with web api controller and ngresource until i required to get count of results. to get just the count of a result i need to use $inlinecount which only seems to be working…
Raas Masood
  • 1,475
  • 3
  • 23
  • 61
0
votes
1 answer

use $inlinecount without MapODataServiceRoute

i have a controller 1 inherited form ApiController returning IQueryable of some entity. i have another controller 2 returning same thing but inherited form ODataController and oData route configurations like this …
Raas Masood
  • 1,475
  • 3
  • 23
  • 61
0
votes
1 answer

Overflow sort stage buffered data usage when trying to skip and take from MongoDB repository

I have a classic REST and ODATA enabled Web API controller calling MongoDB based implementation of a repository pattern. I keep on getting Overflow sort stage buffered data usage of 33556193 bytes exceeds internal limit of 33554432 byte…
0
votes
1 answer

oData's skip() and top() pulling entire record set before filtering

i have an oData enabled web api function [EnableQuery()] public IQueryable Get() { return _storeCommandService.GetAllStoreCommands().AsQueryable(); } the service layer calling Mongodb based Repository pattern's…
0
votes
1 answer

OData Query: Getting several rows based on a column criteria

I have a table that holds an attribute field and its corresponding value. For an instance several attributes are applicable, and I would like to return a specific set of attributes for this instance. |Attribute|Value| ---------- | A …
jonas
  • 1,592
  • 3
  • 20
  • 29
0
votes
1 answer

WebApi OData property route content negotiation

I am trying to mimic the behavior of NuGet.org that returns a package Id for an example URL like: http://www.nuget.org/api/v2/Packages(Id='Nuget.Core',Version='2.8.3')/Id This response looks like:
0
votes
0 answers

EnableLowerCamelCase when using ODataModelBuilder

Turning the JSON result into camelCase is easy when using ODataConventionModelBuilder. var builder = new ODataConventionModelBuilder(); builder.EnableLowerCamelCase(); But how is it done when using ODataModelBuilder? I can't seem to find anything…
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
0
votes
1 answer

OData query option $count in $expand not working

I tried to use $count in an $expand like this query .../OData/Foo(1)?$expand=Bars($count=true) However count is no where to be found in the result. { "...": "...", "Bars": { "...": "..." } } No error either. I'm using ASP.NET Web API…
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
0
votes
1 answer

Using WebApi + Odata on an Edmx

We are currently looking at converting from WCF Data Services to WebApi with Odata. Our entity model is defined using an entity framework defined as an edmx. Im struggling to get the edmx working with WebApi OData due to relationships and complex…
Matt
  • 3,305
  • 11
  • 54
  • 98
0
votes
1 answer

The complex type 'MyData.AssetReading' refers to the entity type 'MyData.Asset' through the property 'Asset'

Looking at setting up Web API odata and trying to expose the data out of our edmx to it. The problem is that every time i add an entity to the OdataConventionBuilder I get a big nasty error message on load saying: The complex type…
Matt
  • 3,305
  • 11
  • 54
  • 98
0
votes
1 answer

Migrating from WCF Data Services to WebApiOdata

We are currently looking at migrating from WCF Data Services to WebApiOData. The problem that I see is that we have to create a method within a webApi controller for every single table/view that we have that we need to query from the client. The…
Matt
  • 3,305
  • 11
  • 54
  • 98
0
votes
1 answer

In C# Odata Server how do I add a filter without affecting the meta-url for the odata

In C# Odata Server how do I add a filter without affecting the meta-url for the odata service? I currently add filters as this: public static void Register(HttpConfiguration config) { config.Filters.Add(new AuthorizeAttribute()); ...
Robert
  • 2,357
  • 4
  • 25
  • 46
0
votes
1 answer

Can't save the data to OData controller after updating to Microsoft.AspNet.WebApi.OData 5.3.x

Not sure what's changed exactly and causing this partial error (since it's not happening with retrieving the data) but after updating Microsoft.AspNet.WebApi.OData library to 5.3.x version, breeze has an issue with saving the data to OData…
coni2k
  • 2,535
  • 2
  • 20
  • 21
0
votes
1 answer

OData V3 action in ASP.NET web api doesn't get trigger

I am using OData V3 endpoints using asp.net with webapi 2.2. I have successfully implemented CRUD operation with it. Now, I would like to add some custom actions along with CRUD operations. I have followed the article (…
user659469
  • 325
  • 1
  • 7
  • 22
1 2 3
8
9