DapperLib / DapperLib/Dapper.Contrib

Dapper.Contrib when insert occurred "ORA-00928" for oracle

Open
#6 13 comments 7 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

I have some problem for insert use Dapper.Contrib.I have class like below

public class Company
{
    public int Id { get; set; } = 1;
    public string CompanyName { get; set; }
}

My table like below picture
image

If i am using sql to insert that is ok.If i use insert to mssql also success but if i use oracle that is wrong.I want show code to below.If You need deep details that must tell me.

public class Company
{
    public int Id { get; set; } = 1;
    public string CompanyName { get; set; }
}

public IDbConnection GetConnection 
{
    get
    {
        string connString = "Data source=localhost/book;User id=C##ANSON;Password=1234;";
        var conn = new OracleConnection(connString);
        return conn;
    }
}

public async Task<IHttpActionResult> Post() 
{
    var companys = new List<Company>();
    for (int i = 0; i < 5; i++)
    {
        companys.Add(new Company
        {
            CompanyName = $"company{i}"
        });
    }
    using (TransactionScope scope = new TransactionScope()) 
    {
        using (var con = GetConnection) 
        {

            //con.Execute("insert into company (companyname) values (:companyname)", companys.Select(x => new CompanyDto { CompanyName = x.CompanyName }));
            //if use above that is success.but if use below that will occurred ORA-00928
            con.Insert(companys);
            scope.Complete();
            return Ok();
        }
    }
} 

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 by reproducing con.Insert(companys) with the shown OracleConnection and compare its generated operation with the direct SQL insert that succeeds. The issue is resolved when inserting the Company list works with Oracle without ORA-00928 while preserving the existing SQL Server behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases
Issue type
Bug
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.