News for hackers. Stuff that matters.
Re:Ask HN: What happened to the ORM? by mewwts on Thursday June 29, 2017 @07:14AM (#14662260)
How do you in practice derive the data layer from the schema? Somehow parsing the schema in the application code?
Re:Ask HN: What happened to the ORM? by jasonkester on Thursday June 29, 2017 @07:45AM (#14662418)
Personally, I generate base classes for table objects at compile time.

You can look at a table and its keys to determine what sort of thing it represents (entity, lookup, association, etc.) and build out helper stuff as needed. So in addition to basic CRUD anything that looks like an entity gets .Load(), .Save() and accessors for fields as well as .GetByWhateverID() methods for any foreign keys. I base my actual Entity classes off of those auto-generated base classes, so they can get blown away and recreated as often as necessary.

I also wrap any one-off stored procs that are lying around in calling code, so that they can be used in place of the standard-issue Frankenstein SQLBuilder thing that an ORM would have.

It's kinda all the upsides of an ORM, but without any dynamic garbage, schema-as-config-file, mystery auto-SQL, migrations, or (again) Almost-SQL-In-The-Magic-Query-Languague to Not-The-SQL-I-Meant conversion.