odata - Data service operation with parameters called from client library fails -


Similar quetion was already asked here:

AME As the problem is now with me, only one thing is different which I pass all the parameters correctly.

I have this operaone method defined in the data service:

  [WebGet] public IQueryable & lt; Tools & gt; GetCompanyEquips (Int ID) {come back. CurrentDataSource.GetCompanyEquips (ID); }   

And I can get results without any problem in my web browser:

But when I try to get results I am doing my customer like this:

  var r = this.CreateQuery & lt; Tools & gt; ("GetCompanyEquips"); R.AddQueryOption ("id", CompanyId); R.ToArray (); I have an exception:  

"An error occurred while processing this request."

In addition to this I see in Debugger whether R. "{}" And I suspect there is something wrong here because I do not know that at the end is id = 18.

In addition to this, when I invoke the method like this:

This .Execute ("") - returns are empty in returns (although exceptions were not raised in this case ), But when I call the same query string in the browser, it shows expected results.

In addition, the method in which there is no parameter - all work fine. Please help! I have spent a whole day for this problem, trying to find the Internet is trying to solve the ant problem, but nothing in my code was found wrong!

Thank you.

AddQueryOption method gives a new instance of IQueryable, so you need to modify your code:

  r = r.AddQueryOption ("id", CompanyId); Another thing: the client library does not help to read the answers to the services that return the primitive or complex types of numbers. Therefore, the type of device should be of an entity type to do this work.   

Comments