DapperLib / DapperLib/Dapper.Contrib

Does not work with OleDbConnection

Open
#145 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
293
Forks
109
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in SqlMapperExtensions.cs at the Get function and trace how SQL and DynamicParameters are constructed. Examine how the @id parameter is handled for SQL Server and what must differ for OleDbConnection's ? notation. Done means the reported SQL Server and MS Access/OleDbConnection use cases are supported without regressing existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.