DapperLib / DapperLib/Dapper.Contrib
Dapper Contrib - doesnt insert into database unless all fields values are provided.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
I am using Dapper Contrib to Insert values into table. The insert doesnt happen unless you provide all Entity property values.
Here is my entity:
[Table("Order")]
public class Order
{
[Key]
public int OrderId { get; set; }
public int Quantity { get; set; }
public decimal? Price { get; set; }
public string PaymentType { get; set; }
}
Here is my Table
CREATE TABLE [dbo].[Order](
[OrderId] [int] IDENTITY(1,1) NOT NULL,
[Quantity] [int] NOT NULL,
[Price] [money] NULL,
[PaymentType] nvarchar NULL
)
Here PaymentType is nullable but unless i pass PaymentType as empty string in the code. dapper contrib doesnt make an insert to table.
Let me know if anyone has faced this.
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 insert with the shown C# Order entity and SQL Server table, comparing the nullable PaymentType case with the empty-string case. Trace Dapper Contrib's insert behavior to determine why the row is not created, then verify the corrected behavior with a regression test using this entity and schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100