14
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 29 Mar 2024
14 points (88.9% liked)
SQL
450 readers
2 users here now
Related Fediverse communities:
- #sql on Mastodon
- #postgresql on Mastodon
- c/PostgreSQL on programming.dev
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 1 year ago
MODERATORS
No matter how you tackle this, your front end likely communicates in json and your database in sql.
At the crux of it, your backend has the job of translating between the two without openly exposing the database to the front end (unless security truly doesn't matter for your app)
There's no easy way to get around the fact you simply just have to write logic to mediate between those two languages.
The best way I use to avoid mismatch problems between BE<->DB is I use Code First Entity Framework Core as my ORM, letting my EF Core spec act as the source if truth fir my db schema via automated EF migrations.
This means the only way you get a mismatch is due to merge conflicts not being resolved properly if 2 devs both mutate the db schema at the same time.
C#'s Linq is also the closest first class API I have seen that very closely mimics sql.
I genuinely find Linq queries on Entity Framework easier to write and read than sql.
LINQ is remarkable.