News for hackers. Stuff that matters.
Re:How not to structure database-backed web apps: performanc... by TekMol on Thursday June 28, 2018 @03:53AM (#17414913)

    I say ORM is the correct choice in many cases
I'm still undecided about this. Would be fun to compare some actual approaches. Which is your favorite ORM?
Re:How not to structure database-backed web apps: performanc... by fuzzy2 on Thursday June 28, 2018 @05:18AM (#17415289)
Currently I’m trying to use Dapper if possible. It allows me to write efficient queries manually and just maps the results to objects.

For simple queries though (single-table), Entity Framework is just as fast.

Because I’m mostly working on dashboards and stuff, writing to the database isn’t much of a concern.

Re:How not to structure database-backed web apps: performanc... by TekMol on Thursday June 28, 2018 @05:24AM (#17415314)
What is the code to get the number of cars with expired insurence when using Dapper?
Re:How not to structure database-backed web apps: performanc... by fuzzy2 on Thursday June 28, 2018 @05:34AM (#17415377)
Something along the lines of

    db.Query<Car>("SELECT * FROM Cars WHERE InsuranceEndDate < @Date", new { Date = DateTime.Now });
/edit: Sorry, missed the "number of". Well, you get the idea. It'd use 'QuerySingle' instead.
Re:How not to structure database-backed web apps: performanc... by TekMol on Thursday June 28, 2018 @06:54AM (#17415770)
That does not look very ORMish to me. It might return objects. But isn't one point of an ORM that you tell the ORM which data you want and not what SQL query to send to the DB?
Re:How not to structure database-backed web apps: performanc... by tfigment on Thursday June 28, 2018 @08:16AM (#17416226)
Also Dapper fan. I like mapping into objects without code generation and complicated queries are easier to write compared to LINQ if familiar with actual SQL. Only thing I really don't like is bulk inserts as it will do one statement per object. You can still use both Dapper and LINQ at same time but it might confuse others.
Re:How not to structure database-backed web apps: performanc... by matwood on Thursday June 28, 2018 @09:25AM (#17416635)
> Which is your favorite ORM?

jOOQ. Not really an ORM, but handles the tedium of mapping results to an object while letting me write type checked SQL. IMO, it is the best solution for dealing with an RDBMS. I wish every language had a jOOQ equivalent.