1

I work with a GraphQL (HotChocolate) API that use EF Core to fetch data from my MS SQL Server.

A few entities have status columns, that are currently created on-demand with a complex query which can be translated to SQL with EF Core. The status is generated with a query of 3-5 tables.

query {
  person(where: {status: {eq: Status1}}){
   {...}
}

Now I want to make this column filterable with GraphQL, which is currently not possible, because the column is generated in the resolver of the entity.

Is there a good way to filter a computed column with GraphQL or a good solution to store such complex computed columns in the database, which will be updated in a short interval?

I thought to store it in the database and make a CRON Job/SQL Job that updates the value each hour or so, but this solution just doesn't feel right.

bealtis
  • 23
  • 5
  • 1
    Have a look at [Views](https://learn.microsoft.com/en-us/sql/relational-databases/views/views?view=sql-server-ver16) and [Keyless Entity Types](https://learn.microsoft.com/en-us/ef/core/modeling/keyless-entity-types?tabs=data-annotations). – paolo Jan 27 '23 at 14:28

0 Answers0