Pregunta

I'm new to odata and WebApi. I'm trying to send the following odata query: ?$filter=ExternalIds eq '5'

ExternalIds is part of an object and define as:


public Id ExternalIds { get; set; }

public class Id { [DataMember] public string Name { get; set; } [DataMember] public string Value { get; set; } }

i'm getting the error: "A binary operator with incompatible types was detected. Found operand types 'GenericAPIInterface.Entities.User.Id' and 'Edm.String' for operator kind 'Equal'."

¿Fue útil?

Solución

In order to use the property values on a related class you will need to use the navigation syntax within $filter, e.g. ...?$filter=ExternalIds/Value eq '5'. Also, if ExternalIds is an entity (has it's own id), you may want to expand it using $expand. This is not strictly necessary for the filter clause to work, however.

Otros consejos

I think I just had the same problem - turned out that I used a query Id eq "5" while it should have been Id eq 5 so unquoting basically helped.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top