c# - How to create query expression for Odata for get by Id -


I have created an Odata service and now I am trying to consume this service in customer favor. I want to create expressions like URL below in C # query expression -

The above URLs are working fine in browsers but I want to create query expressions in C # above URL Any help for this would be very commendable.

In DataServiceContext + data service service Remember to hit the System.Data.Services.Client URL, that a query is not executed before calling because of lazy loading.

  var reference = new data service service (new URI ("http://odata.org/Product-Service"), Data Services Service Protocol.V3); Var query = context.CreateQuery & lt; Products & gt; ("Product"); Product Product = query.Where (P => PIID == 150). first ();  

The above should be solved in which you can check by looking at the query.Entities collection. There will be one URI in each unit in the collection.

In addition, if your product category includes a navigation property, then you need to add the extension query option:

  var query = Context.CreateQuery & lt; Products & gt; ("Product"). AddQueryOption ("$ Expansion", "NavigationProperty");  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -