DapperLib / DapperLib/Dapper.Contrib
SqlMapperExtensions.Get doesn't work on netcore2.2 in Linux platform
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
I have a project which run perfect in net core 2.2 in Windows platform, but since i switch to Linux platform (Ubuntu 20.04), I get a suddent error with "Get only supports an entity with a [Key] or an [ExplicitKey] property". Then I found https://github.com/StackExchange/Dapper/blob/6ec3804f2c44f2bf6b757dc3522bf009cc64b27d/Dapper.Contrib/SqlMapperExtensions.cs#L112, This code try to find some property which name is Id (case ignore), but since StringComparison.CurrentCultureIgnoreCase has some issue in netcore 2.2 in Mac/Linux, so this code return idProp with null caused the error. I think use this
var idProp = allProperties.Find(p => string.Equals(p.Name.ToLower(), "id"));
may be better.
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 at Dapper.Contrib/SqlMapperExtensions.cs around line 112 and reproduce SqlMapperExtensions.Get on netcore2.2 under Ubuntu 20.04 with an entity whose key property is named Id. Verify the case-insensitive lookup behavior and confirm that Get recognizes the key without raising the missing [Key] or [ExplicitKey] error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100