odata.net
odata.net copied to clipboard
ODL requires collection items on the RHS of "in" operator to be strings
ODL requires collection items on the RHS of in operator to be strings.
The following filter expression where DynamicPrimitiveCollectionProperty is a dynamic property is not parsed successfully.
$filter=DynamicPrimitiveCollectionProperty in (19,17)
Assemblies affected
- Microsoft.OData.Core 8.x
- Microsoft.OData.Core 7.x
Reproduce steps
var model = new EdmModel();
var customerEntityType = model.AddEntityType("NS", "Customer", baseType: null, isAbstract: false, isOpen: true);
customerEntityType.AddKeys(customerEntityType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
var entityContainer = model.AddEntityContainer("Default", "Container");
var customersEntitySet = entityContainer.AddEntitySet("Customers",
customerEntityType);
var filterClause = new ODataQueryOptionParser(
model,
customerEntityType,
customersEntitySet, new Dictionary<string, string> { { "$filter", "DynamicPrimitiveCollectionProperty in (19,17)" } }).ParseFilter();
Expected result
The filter expression to be parsed successfully.
Actual result
Additional detail
Works if the collection items are strings, e.g., DynamicPrimitiveCollectionProperty in ('19','17')