mardi 12 juillet 2016

How to convert Dapper DynamicParameter to DbParameter[]?

When using query method in Dapper.NET library, the funciton code is here:

    public IEnumerable<dynamic> Query(IDbConnection conn, string sql, dynamic param = null, IDbTransaction trans = null, bool buffered = true)
    {
        return SqlMapper.Query(conn, sql, param as object, trans, buffered);
    }

Our customer use their own data access library, they dont use SqlMapper class in Dapper library. So they need to change param to DbParameter[]. There are many references with Query method, it is better to only change param object to DbParameter array, otherwise we have to modify every reference in our code.

Is there a good way to find a solution to fix this issue? Thanks.

Aucun commentaire:

Enregistrer un commentaire