DapperLib / DapperLib/Dapper.Contrib
Replace annotations with fluent configuration
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
i'm quite new to dapper. I was interested about performance as many users i think. Today i came across a really painful issue. I mean it is painful because to me it seems that things are not correctly implemented. I'm not criticizing just telling how things should be dealt from my own point of view, some of you may share.
My scenario:
I have a table with many cells (over 500 on a single screen). As soon as a user click (or drag drop) a cell, the cell is colored according to the user selection and data is sent to the server to insert/update the slot that was modified. To have faster interaction i don't want to wait the server 200 response and thus fire asynchronously my post/put methods.
In that scenario, i can not have the ID of my item to be set on the server. Moreover my key is a Guid and i should make another request to get the id if it was set by SQLServer.
The only solution is to set the Guid manually. I thought this was quite a standard scenario, but i was astoned when i found out that the inserted ids where not the ones provided. They were set by a default value I set on the db.
Why? Because when the request is generated, the keys are defined as follow:
If a Key attribute is set, then the property is considered by default as an autogenerated key. If no attribute is found then the system tries to find an Id property. If it is found it is also considered as an autogenerated key unless you set an ExplicitKey attribute on the property. That's a bit rough. The system considers by design that your keys have to be an autoincremented integer. Otherwise you have to explicitely tell it is not.
For my scenario, it is not possible as i can't afford waiting for the item id. My only solution is to write the request by hand. Why? Because i don't want my entities to be dependant on dapper. I don't think it's wierd. To me this attribute annotation is a real showstopper.
What about a fluent configuration?
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 reviewing the key-detection and request-generation behavior described in the issue, including how Key and ExplicitKey affect generated identifiers. Define done as a fluent configuration option that supports manually assigned Guid keys without entity annotations while preserving existing key behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100