Dapper Contrib - Data Annotation - Write

Description

Specifie if the property is writable or not.

  1. [Table("Invoice")]
  2. public class InvoiceContrib
  3. {
  4. [Key]
  5. public int InvoiceID { get; set; }
  6. public string Code { get; set; }
  7. public InvoiceKind Kind { get; set; }
  8. [Write(false)]
  9. [Computed]
  10. public string FakeProperty { get; set; }
  11. }
  12. using (var connection = My.ConnectionFactory())
  13. {
  14. connection.Open();
  15. var invoice = connection.Get<InvoiceContrib>(1);
  16. // The FakeProperty is null
  17. }