Contains/StartsWith fails when invoked via WCF Data Service.
Description
I am using WCF Data Services with Nhibernate Linq as the provider. When formulating queries in the client that use Contains/StartsWith the linq provider fails with a "An item with the same key has already been added." I have attached the stacktrace and a sample project which demonstrates the problem. The project contains a host and client with the entity mapped without lazy loading.
AS a possible workaround I change the query on the service to automatically call ToList() and AsQueryable() but this causes an immediate fetch of all the records in the table which are then filtered in memory using the criteria specified by the client.
Resolving as fixed. There has probably been a number of reasons why this didn't work, but after fixing I do not get an error with the attached test case.
Moravek, Christian (RC-AT SI EA EAST OEX TIN)
March 2, 2011 at 2:08 PM
Hello,
I have the same problem (also if I use the trunk version). Whenever I use "contains" I get the following error message: An item with the same key has already been added.
I have tested it with LinqPad 4 and with an url in the browser.
Regards Christian
Andrei
February 28, 2011 at 4:58 AM
Hello,
I'am using Contains/StartsWith with the trunk version and I don't have any issue with your query. However in my data source I implemented the IDataServiceQueryProvider (in a separate class) and the method IDataServiceQueryProvider.IsNullPropagationRequired returns false.
I am using WCF Data Services with Nhibernate Linq as the provider. When formulating queries in the client that use Contains/StartsWith the linq provider fails with a "An item with the same key has already been added." I have attached the stacktrace and a sample project which demonstrates the problem. The project contains a host and client with the entity mapped without lazy loading.
AS a possible workaround I change the query on the service to automatically call ToList() and AsQueryable() but this causes an immediate fetch of all the records in the table which are then filtered in memory using the criteria specified by the client.
Sample query:
http://localhost:9999/SampleDataService/Categories()?$filter=substringof('e',CategoryName)