Console application
var result = dataService.CreateQuery<Customers>('GetCustomerByLastName'). AddQueryOption('lastname', 'S');
Service
[WebGet] public IQueryable<Customers> GetCustomerByLastName( string lastname ) { return from c in this.CurrentDataSource.Customers where c.LastName.StartsWith( lastname ) select c ; }
results in: (relative to http://localhost:1478/Apress.Data.Services.CustomerService.Host/)
RequestUri: CustomerDataService.svc/GetCustomerByLastName()?lastname=S
and fails as a result , because of parentheses in uri , which are not expected.
CustomerDataService.svc/GetCustomerByLastName?lastname=’S’
works in a browser.
VS 2008 SP1 .
It turned out the problem was not related to parentheses , I was missing string literal single quotes
should be
but
and
both correct for ADO.Net Data Services.