Would somebody at Microsoft care to explain why, when constructing a URI for
use by ADO.Net Data Services, I have to use this type of syntax with
startswith() and endswith():
sbrUri.AppendFormat("$filter=endswith(ProductName,'{0}')&", productName);
sbrUri.AppendFormat("$filter=startswith(ProductName,'{0}')&", productName);
while substringof() uses a bass akwards (IMO) syntax of:
sbrUri.AppendFormat("$filter=substringof('{0}',ProductName)&", productName);
It makes it difficult to implement even a rudimentary wild-card search
capability when you throw us curves like the one above in which the argument
order is reversed from what is used by startswith() and endswith().
Not the end of the world, but it wasted several minutes of my time trying to
figure it out.
In my simple example, I was hoping to quickly implment the ability to search
for:
1. All products that begin with a given value, such as Ch*.
2. All products that end with a given value, such as *e.
3. All products that contain a given value, such as *ha*.
The first two were easy, but the last one drove me nuts because of the
strange syntax of the substringof() filter function.
|