Dapper Contrib - Data Annotation - Key

Description

Specifie the property is a key that is automatically generated by the database (Identity Column).

[Table("Invoice")]
public class InvoiceContrib
{
[Key]
public int InvoiceID { get; set; }

public string Code { get; set; }
public InvoiceKind Kind { get; set; }

[Write(false)]
[Computed]
public string FakeProperty { get; set; }
}

using (var connection = My.ConnectionFactory())
{
connection.Open();

var identity = connection.Insert(new InvoiceContrib {Kind = InvoiceKind.WebInvoice, Code = "Insert_Single_1"});
}