Does anyone know if its possible and if so, what the syntax is for calling a service operation via linqpad?
Also, can I used named parameters when I call it using linqpad- how? That would be great b/c I have a lot of parameters in the service operation and I don't want to have to specify each one.
Thanks!
Unfortunately, this is not possible: LINQPad relies on the .NET WCF client and EntityClassGenerator in System.Data.Services.Design.dll, which don't really support service operations (as of Framework 4.0).
The workaround at this stage is the same as what you'd do if you were coding in Visual Studio and is described well here.
Hence you could type the following into LINQPad to call the operation GetContacts(string firstName):
this.Execute<Contact> (new Uri ("GetContacts?firstName='John'", UriKind.Relative))
or, if the service returns a sequence of objects:
CreateQuery<Contact>("GetContacts").AddQueryOption("firstName", "'John'")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With