Skip to content

BUG: Predicate query fails when searching for a text word that is the same as an Entity name. #73

@EchoFoxxtrot

Description

@EchoFoxxtrot

Consider the following scenario:

I have an entity type called Area that corresponds to an Area table in my database and I have another entity type in the same entity metadata set that contains a Title field, defined as a string, that I want to query against by creating a Predicate something like the following:

let searchFilter = 'area' // simulating typed input from a search criteria entered by a user through the UI
let myNewPredicate = new Predicate('Title', FilterQueryOp.startsWith, searchFilter);

I then use my predicate with the EntityQuery.where() method to query my other table which DOES NOT have a field or navigation property called "Area".

The result is that I will receive an error from the EntityManager that states:

Error: unable to locate property: Area on entityType:
<MyOtherEntityClass>#<My.DataAccessModel.Namespace>

This is true when you write any Predicate using any valid FilterQueryOp operator to query for any string that is an exact caseless match of the name of any Entity Type that is registered from a server Metadata call on an Entity Framework Core dbContext.

My current workaround to this is to remove the last character of a "startsWith" predicate or the first character of an "endsWith" predicate, but it gets dicey when I need to use an "equals" predicate, so it would be nice if this bug could be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions