Closed
Description
Description
Steps to reproduce:
- I have model like this (reduced for simplicity)
public class Client: Identifiable
{
[Attr]
public string FirstName { get; set; }
[HasOne]
public Advisor Advisor { get; set; }
public int AdvisorId { get; set; }
}
- I have registered custom repository with Get() override:
public override IQueryable<Client> Get()
=> base.Get()
.Where(e => e.AdvisorId == 1);
- I made request: GET /api/clients?fields[clients]=firstName
- Empty array is returned and console shows:
warn: Microsoft.EntityFrameworkCore.Query[20500]
The LINQ expression 'where (new Client() {Id = [x].Id, FirstName = [x].FirstName}.AdvisorId == 1)' could not be translated and will be evaluated locally.
I can see, that there is strange translation with Where condition (There is statament that belongs to Select query)
I think, that using this line cause the problem
Do you have any idea how to fix this? I can make PR, but I have no idea how to combine those
Provider.CreateQuery, standard LINQ query builder, selects and where queries...
Environment
- JsonApiDotNetCore Version: 3.1.0
Metadata
Metadata
Assignees
Labels
No labels