We are migrating databases from Oracle to MySQL. Oracle and MySQL use a different character for the bind variables @
and :
. We are using Dapper to query the database. We pass in DynamicParameters into Dapper and the bind variables work.
What I want to be able to do is go through the DynamicParameters and look at the name of the value and change the character on the front and then replace it in the SQL string as well. I know how I would do this.
The problem I have is that you cannot enumerate the DynamicParameters to get the key and value.
My ideas is to try and get hold of the private <string, DynamicParameters.ParamInfo> parameters
field at runtime using reflection. I can't work out how to make it work as DynamicParameters.ParamInfo
is a private class.
Any ideas on what I could do?
Aucun commentaire:
Enregistrer un commentaire