The arguments supported are ids, where, orderBy , skip, and take.
Arguments are executed in that order.
Queries entities by id. Currently the only supported identity member (property or field) name is Id.
String, Guid, Double, Boolean, Float, Byte, DateTime, DateTimeOffset, Decimal, Int16, Int32, Int64, UInt16, UInt32, and UInt64.
{
entities (ids: "1")
{
property
}
}{
entities (ids: ["1", "2"])
{
property
}
}Where statements are and'ed together and executed in order.
All where statements require a path. This is a full path to a, possible nested, property. Eg a property at the root level could be Address, while a nested property could be Address.Street. No null checking of nested values is done.
String, Guid, Double, Boolean, Float, Byte, DateTime, DateTimeOffset, Decimal, Int16, Int32, Int64, UInt16, UInt32, UInt64, and Enum.
equal(the default value ifcomparisonis omitted)notEqualgreaterThangreaterThanOrEquallessThanlessThanOrEqual:contains: Only works withstringstartsWith: Only works withstringendsWith: Only works withstringin: Check if a member existing in a given collection of valuesnotIn: Check if a member doesn't exist in a given collection of valueslike: Performs a SQL Like by usingEF.Functions.Like
Case of comparison names are ignored. So, for example, EndsWith, endsWith, and endswith are allowed.
Single where statements can be expressed:
{
entities
(where: {
path: "Property",
comparison: "equal",
value: "the value"})
{
property
}
}Multiple where statements can be expressed:
{
entities
(where:
[
{path: "Property", comparison: "startsWith", value: "Valu"}
{path: "Property", comparison: "endsWith", value: "ue"}
]
)
{
property
}
}{
testEntities
(where: {
path: "Property",
comparison: "in",
value: ["Value1", "Value2"]})
{
property
}
}All string comparisons are, by default, done using no StringComparison. A custom StringComparison can be used via the case attribute.
{
entities
(where: {
path: "Property",
comparison: "endsWith",
value: "the value",
case: "Ordinal"})
{
property
}
}Note that many Database Providers, including SQL Server, cannot correctly convert a case insensitive comparison to a server side query. Hence this will result in the query being resolved client side. If this is a concern it is recommended to Disabling client evaluation.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.ConfigureWarnings(
warnings =>
{
warnings.Throw(RelationalEventId.QueryClientEvaluationWarning);
});
}Null can be expressed by omitting the value:
{
entities
(where: {path: "Property", comparison: "equal"})
{
property
}
}{
entities (orderBy: {path: "Property"})
{
property
}
}{
entities (orderBy: {path: "Property", descending: true})
{
property
}
}Queryable.Take or Enumerable.Take can be used as follows:
{
entities (take: 1)
{
property
}
}Queryable.Skip or Enumerable.Skip can be used as follows:
{
entities (skip: 1)
{
property
}
}