DapperLib / Dapper.Contrib

Dapper community contributions - additional extensions for Dapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work with OleDbConnection

DrViente opened this issue · comments

Good morning everyone.

I figured out that Dapper.Contrib does not support OleDbConnection, that because, for example on the Get function of SqlMapperExtensions.cs do:

var type = typeof(T);

            if (!GetQueries.TryGetValue(type.TypeHandle, out string sql))
            {
                var key = GetSingleKey<T>(nameof(Get));
                var name = GetTableName(type);

                sql = $"select * from {name} where {key.Name} = @id";
                GetQueries[type.TypeHandle] = sql;
            }

            var dynParams = new DynamicParameters();
            dynParams.Add("@id", id);

the "@" notation is not supported on OleDb, for my example I need to operate bot SQL Server and MS Access DB and OleDBConnection is the only way to accomplished both connection

There is a plan to support OleDbConnection "?" notation?

I just made a pull request fixing just this. Maybe you can try if it works for you aswell?

#148