mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-27 03:27:02 +08:00
use case insensitive property match first, with insensitive fallback
This commit is contained in:
+3
-1
@@ -449,7 +449,9 @@ namespace Dapper
|
||||
|
||||
var setters = (
|
||||
from n in names
|
||||
select new { Name = n, Info = properties.FirstOrDefault(p => p.Name == n) }
|
||||
let prop = properties.FirstOrDefault(p => string.Equals(p.Name, n, StringComparison.InvariantCulture)) // case sensitive first
|
||||
?? properties.FirstOrDefault(p => string.Equals(p.Name, n, StringComparison.InvariantCultureIgnoreCase)) // case insensitive second
|
||||
select new { Name = n, Info = prop }
|
||||
).ToList();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user