You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using HotChocolate backed by an EF Core model. I would like to be able to use a filter to retrieve entities where some navigational property is null.
Eg, assume a data model like this
class Person {
public string Id { get; set; }
public Car? Car { get; set; } // optional one-to-one mapping to Car
public string Name { get; set; }
}
class Car {
public string Id { get; set; }
public string OwnerId { get; set; }
public Person Owner { get; set; }
public string Make { get; set; }
}
class Query {
[UseFiltering]
public IQueryable<Person> GetPeople(MyDbContext dbCtx) => dbContext.Persons.AsQueryable();
}
I would like to be able to get Persons who do not have a car (eg person.Car == null).
Is there a way to do this with the built-in filtering support, or does it require a custom filter operation? I would have expected something like this to be possible "out of the box", but i haven't figured out a way.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using HotChocolate backed by an EF Core model. I would like to be able to use a filter to retrieve entities where some navigational property is null.
Eg, assume a data model like this
I would like to be able to get
Person
s who do not have a car (egperson.Car == null
).Is there a way to do this with the built-in filtering support, or does it require a custom filter operation? I would have expected something like this to be possible "out of the box", but i haven't figured out a way.
Beta Was this translation helpful? Give feedback.
All reactions