How to Get entity by Unique Key using Dapper.Contrib?
问题 I have an object, assume public class User { [Key] int TheId { get; set; } string Name { get; set; } int Age { get; set; } } TheId is my auto increment column and Name is my unique key. When saving a user, I want to check its existence by: var user= connection.Get<User>("John"); But, because of my Key is not Name but TheId , I can't do this. If I set Name property as [KeyExplicit] that time when I want to save my user by: connection.Insert(myUser); This time, dapper expect TheId property