0

I have a WCF data services' service operation such as

[WebGet(UriTemplate = "GetData")]
public IQueryable<string> GetData(int code, int deviceid, int groupId, DateTime dateTimeFrom, DateTime dateTimeTo)
{ ...
}

I am calling this service operation by sending a HTTP request to the server in this format:

http://localhost:6000/GetData?code=0&deviceId=1&groupId=0L&dateTimeFrom=datetime'2013-01-31T15:36:50.904'&dateTimeTo=datetime'2012-02-01T15:36:50.904'

and it is working like a charm.

Now I want to pass a NULL value as one of the parameters. How do I do that? Do I need to use nullable types such as "Int?" in the service operation declaration? How do I encode the NULL value in the URI?

Tomas Walek
  • 2,516
  • 2
  • 23
  • 37

1 Answers1

0

Yes - you need to declare the parameter as nullable. Then you can simply omit the parameter (if it's nullable it will be treated as null then).

Vitek Karas MSFT
  • 13,130
  • 1
  • 34
  • 30