DapperLib / DapperLib/Dapper.Contrib
ExplicitKey vs Default constraint
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
Hi there!
Few days ago I faced one issue.
I have table Users
(
[Id] uniqueidentifier NOT NULL DEFAULT (NEWID()),
PRIMARY KEY (Id)
)
And I have Model User.cs with [ExplicitKey] attribute on Id property
So here is funny thing... this ExplicitKey do nothing... Entity always created with new Id...
I don`t know is it normal behavior or not.... As I now Entity Framework has None Identity that allows using custom generated id

Thanks!
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 with the User.cs model and the SQL table definition in the issue, then trace how ExplicitKey is handled when an entity is inserted. Reproduce the NEWID() default-key case and compare the observed identifier behavior with the documented meaning of ExplicitKey; done should establish whether this is expected or define the required corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100