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.

Sample query:
http://localhost:9999/SampleDataService/Categories()?$filter=substringof('e',CategoryName)

Environment

None

Attachments

2

Activity

Show:

Alex Zaytsev 
September 8, 2014 at 11:31 AM

Close issues resolved in 3.3.3

Oskar Berggren 
December 21, 2012 at 10:57 PM

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.

Andrei

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created February 17, 2011 at 7:26 AM
Updated September 8, 2014 at 11:31 AM
Resolved December 21, 2012 at 10:57 PM
Who's Looking?