I'm trying to implement simple queries like SELECT * FROM TABLE_X WHERE XID = @id
, but the problem that I'm having is that these queries would run on different databases (SQL Server and Oracle) for different application instances.
How to do it without to have to write each database a new set of queries?
2条答案
按热度按时间vlurs2pr1#
Dapper is really close to the database, and allow you to leverage pure SQL tricks specific for a specific database. In my opinion you should use a query object pattern, so you will have an interface in front of each extraction /commit that would possibly change for SQL/Oracle.
oxcyiej72#
I've downloaded the code of
SqlMapper.cs
and hackedSetupCommand
to check if the command is from Oracle or SQL Server.That was what I did: