Menu
  • HOME
  • TAGS

Applying Distinct to OData query

c#,odata,asp.net-web-api-odata,odata-v4

The best solution to solve the problem by defining an collection Action on the resource. First Step : configure the 'Distinct' action in WebApiConfig.cs ODataConventionModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet<FooBarBaz>("FooBarBazs");//Resource Name ActionConfiguration Distinct = builder.Entity<FooBarBaz>().Collection.Action("Distinct");//Name of the action method Distinct.ReturnsCollectionFromEntitySet<FooBarBaz>("FooBarBazs");//Return type of action...

alphanumeric string in OData v4's function string parameter is parsed as int into string, or null

c#,asp.net-web-api,odata,odata-v4

As per comment chain on the question, it seems like the manner in which the routing conventions are populating the function parameters is doing something strange. Since attribute based routing is the first that runs, using it seems to make sure "the right thing" happens. To narrow down the issue...

How to call an OData function/action generated by a OData client generator?

c#,odata,odata-v4

You can refer client delayed query. For your case: var entContainer = new Container(new Uri("http://someurl")); bool result = entContainer.Ents.ByKey(IdOfEnt).MethodX(p1, p2).GetValue(); ...

How to generate OData v4 Client for Silverlight 5?

silverlight,asp.net-web-api,odata,generator,odata-v4

Silverlight does not support the code generated by Microsoft's OData v4 Client Code Generator visx (OData Client T4), but no one's forcing you to use generated code. Simply use the lib of your choice to create a connection to the OData service and reuse your own types (business objects)....

Getting related entities ASP.NET WebApi OData v4 results in “No HTTP resource was found that matches the request URI”

c#,asp.net,asp.net-web-api,odata-v4

As I mention in the question, I tried many solutions to get this to work, but none were consistent in actually solving the problem and I kept avoiding the solution laid out in this SO question/answer because the tutorial is specifically for v4 and I figured that answer must be...

Bound function call returns InvalidOperationException

c#,asp.net,odata,odata-v4,t4-template

I guess you are using T4 2.2.0, right? There is a bug in T4 2.2.0 which causes this issue. You can use the content in following link to replace your ttinclude file and regenerate your proxy to work around the issue. https://raw.githubusercontent.com/LaylaLiu/odata.net/T4TempFix/src/CodeGen/ODataT4CodeGenerator.ttinclude...

OData query option $count in $expand not working

asp.net-web-api,odata,asp.net-web-api-odata,odata-v4

This feature hasn't been implemented yet. A related issue has been created https://github.com/OData/WebApi/issues/165 .

odata - combining $expand and $select

select,asp.net-web-api,expand,odata-v4

After going through a lot of time on this, I finally got the answer, we can nest select within expand using ; as a separator, something like odata/Products(08f80b45-68a9-4a9f-a516-556e69e6bd58)?$expand=productItemChoices($select=anycolumnnameinproductItemChoices;$expand=item($select=name)) ...

Error when using $select and $expand with Odata v4.0 on Web API 2.2

odata,asp.net-web-api2,odata-v4

You should write your query like this: http://localhost/User?$filter=id eq 312&$select=*&$expand=userGroups($select=id) By the way, you can also remove the $select=* segment as all non-navigation properties are by default included in the response. ...

Tool to visualise OData WebAPI / WCF Data Service?

odata,wcf-data-services,odata-v4,odata-v3

LINQPad implements an "OData / WCF Data Services" connector. So, you can explore metadata and query data quikly.

How does one define an (optional) navigation property (?$expand=) in code?

asp.net-web-api,odata,entity-framework-6,asp.net-web-api-odata,odata-v4

It looks I got this one answered as to related another post and little pushing from another forum. About the exception, indeed, it was caused by the query hitting to the database and trying to retrieve columns which aren't defined there. For more information: The specified type member is not...

Injecting OData v4 into MVC 6

c#,asp.net-mvc-6,odata-v4

ASP.NET MVC 6 does not yet support OData. To host OData in ASP.NET I would currently recommend using ASP.NET Web API 2.x, which supports both OData v3 and OData v4. If you want to use OData in an ASP.NET 5 app, you can use the OWIN bridge to host Web...

Cannot return object

c#,odata,odata-v4

Your function configuration has some problem. You should call as follows to define the return: builder.EntityType<Product>().Collection.Function("GetByName").ReturnsFromEntitySet<Product>("Products").Parameter<string>("Name"); Then it can work. Thanks....

Suffix “.svc” on url for odata service

asp.net-web-api,odata,asp.net-web-api-odata,odata-v4

The .svc extension was used by WCF Services as the Service-Document and the entry point of the service. Since Web-API uses routing, you do not have (and need) this svc-file. You can however simulate one if you like to, but it is not good practice. In fact the .svc ending...