DapperLib / DapperLib/Dapper.Contrib
SQL logic error near ")": syntax error - with Contrib
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
Hi
I've noticed that when making superclass as DAL containing CRUD operation with SQLite it always give this error
the code is like that
public abstract class DataEntity : IDisposable
{
public virtual void Insert()
{
using (var db = ConFactory.Connection)
{
db.Open();
var tr = db.BeginTransaction();
db.Insert(this, tr);
tr.Commit();
}
}
}
and my classes looks like that
[Table("[test]")]
public class Test : DataEntity
{
[Key]
public int TestId { get; set; }
public string Name { get; set; }
}
using the code like this will result SQL logic error near ")": syntax error
using (Test t = new Test { Name = textBox2.Text })
{
t.Insert();
textBox1.Text = t.TestId.ToString();
}
BUT when Insert method dragged to [Test] class it works perfectly
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the SQLite insert with the abstract DataEntity.Insert method and compare it with the same method placed directly on Test. Trace how db.Insert(this, tr) determines the table and columns for the inherited object; done means both forms insert successfully and assign TestId without the syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100