Up front, the guy on the keyboard here is way overdue on the sleep department. But also kinda desperate.
I have a Data-service [WebGet] method, setup like this.
[WebGet]
public string Finalize(string PayloadObject, string CltUUID, string Comment){..}
It return a simple string, depending on the outcome of the execution inside. This is working fine.
I call it like this
var res = base.ServiceRef.CreateQuery<DBcontext>("Finalize")
.AddQueryOption("PayloadObject", string.Format("'{0}'", builder.ToString()))
...
How do I get this query to materialize?
Usually one uses res.ToList(), ToArray() or .First(). If I do, I get an exception. Using .ToString() does not execute the query, just returns the url.
The query works, if I break in a line after this code and click ‘View…’ in the debugger, the query is executed, the method runs on the server.
It seems I just don’t get it to run, what am I missing?? besides sleep
Thanks for any pointers
Regards, Andreas
I think you cannot use
CreateQueryto call operation returning single value. You must use Execute instead. MSDN documentation also mentions that operations returning primitive types cannot useQueryOptionwhich make sense because query option is used to define query forIQueryable. If you need to pass parameters try to use common WCF REST approach to specify template inWebGetand on client side use the URI with parameters correctly included.You can also try to use
SingleResultAttributeon your service operation.