Chris Wright wrote:
On Sun, 01 Jan 2017 10:29:28 +0100, Jacob Carlborg wrote:

On 2017-01-01 04:24, Adam Wilson wrote:

My idea: Each data store has it's own implementation with it's own
naming convention. For example (ADO.NET):
      - SqlConnection (MSSQL)
      - NpgsqlConnection (Npgsql)

Yes, this means that you have to change names in your code if you
switch data-stores, but since you are already changing your queries,
which is a much more difficult change, this isn't a significant
additional cost.

I don't think we should try to make implementations different just
because. If you have an SQL builder or an ORM on top of the interface
that abstract the differences in the SQL syntax, it's possible to switch
driver, within reason.

Those both limit your ability to use the underlying database to its full
potential. They offer a chance for queries that seem simple and efficient
to become horribly inefficient.


I cannot state my agreement with this paragraph enough. Every ORM I've worked with generates some inexplicably horrific SQL in seemingly simple situations.

I ran across a problem in NHibernate about a decade ago. We had a
straightforward HQL query involving joins. It took over a minute to run.
We wrote the simple equivalent in SQL and it completed in milliseconds.
Fortunately, NHibernate had the ability to run raw SQL queries.


I've also seen Entity Framework 6/7 do the same thing.

--
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;

Reply via email to