Reputation: 105
I am trying to filter some elements like this:
model = model.Where(feature => item
.Input
.Contains(feature
.GetType()
.GetProperty(item.Attribute)
.GetValue(feature)
.ToString()));
item
is an object that receives data about the filtering, for instance item.Input
is a List<string>
containing what the user filled in and item.Attribute
(is string
) is the column I'm supposed to look at. The field I've tested the error on is a field of type Guid?
and it's called AssignedUserId
and the curious thing is that this works:
model = model.Where(feature => item.Input.Contains(feature.AssignedUserId.ToString()));
As a note, this works:
model = model.Where(feature => feature
.GetType()
.GetProperty(item.Attribute)
.GetValue(feature)
.ToString() == item.Input.ElementAt(0));
So item.Attribute
is populated well, and the filter works.
The error I'm getting is:
System.InvalidOperationException: The binary operator NotEqual is not defined for the types 'Microsoft.EntityFrameworkCore.Storage.ValueBuffer' and 'Microsoft.EntityFrameworkCore.Storage.ValueBuffer'.
What's the problem with getting the field value like in the first code sample?
Upvotes: 3
Views: 2556
Reputation: 549
which version of entityframework are u using?
i got the same error and this is already fixed in 2.1.0-preview1 release like is discussed here issue 9771
Upvotes: 2