Is there a way with dapper-dot-net to use an attribute to specify column names that should be used and not the property name?
public class Code
{
public int
For selects, you can add constructors to your classes to perform the mapping. The constructor parameter names must match the table columns.
Below is an example from the source. The table will be correctly mapped to the class.
Table:
CREATE TABLE #Users (Id int, Name varchar(20))
Class:
class UserWithConstructor
{
public UserWithConstructor(int id, string name)
{
Ident = id;
FullName = name;
}
public int Ident { get; set; }
public string FullName { get; set; }
}