I understand a filter condition can be applied in a query e.g
query{
MyObject(where: {id: {eq: 1}}){
id
name
}
}
which would access the server side query:
[UseDbContext(typeof(dbContext))]
[UseProjection]
[UseFiltering]
[UseSorting]
public IQueryable<MyObject> GetMyObject([ScopedService] dbContext context)
{
return context.MyObject;
}
This can also be expressed on the server side query e.g (.Net implementation).
query{
GetMyObjectById(id: 1){
id
name
}
}
public async Task<MyObject> GetMyObjectById(int id)
{
return dbContext.MyObject.FindAsync(id);
}
My question is, why would one be used over the other?