© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•7mo ago•
18 replies
Manaravak

Dynamic EF Core LINQ Queries for API Consumption

Soo, anyone have any thoughts on this?

I have 2 servers, one is an ASP.Net 9 API using EF Core and the other is an Astro.js client consuming the API (via serverside code only). The API server collects a lot of data from various sources that I want to use to generate datasets/analytics in a dashboard. The API is extremely low maintenance (i.e. I basically only have to touch it if I want to add new EF Core migrations for new data) and is essentially only acting as a tool to populate a DB and manage its schema.

I want to be able to pretty much query the data however I want without having to touch the API server, so I was thinking of either using GraphQL or creating/using some kind of JSON to EF Core LINQ builder.

I'm not finding any existing libraries that really do what I want to be able to dynamically build EF queries from JSON/API requests, and I'd rather not have to develop anything custom as I'm sure that'd be a PITA. But with GraphQL—which I'm not entirely familiar with so correct me if I'm wrong—it seems that if I added new DB entities or properties to those entities, or if I wanted to add additional features like (e.g. pagination or new queries), I'd still have to update the API query layer to some extent—so basically, mostly low maintenance and moderately flexible compared to being able to dynamically generate a LINQ query directly.

My ideal is if I need to pull new sets of data, or calculate different stats on the API DB data, all I have to do is add a new query on the client server only, and if I did need to add new types/sources of data on the API side, I would only need to touch the DbContext and services that collect the data while leaving the API query layer alone…

I basically wish I could just build EF Core LINQ queries directly from my client server.

Thank you for reading all that 🫠. Suggestions/ideas appreciated.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ Memory and performance on big queries LINQ & EF Core
C#CC# / help
3y ago
❔ EF Core LINQ translation document
C#CC# / help
3y ago
❔ Help with EF Core Linq statement
C#CC# / help
4y ago
abstract methods inside EF core queries
C#CC# / help
11mo ago