Mapping Pocos
Mapping Pocos
Example Pocos/Mappings
public class Note { public int Id { get; set; } public DateTime CreatedOn { get; set; } public string Text { get; set; } }
[ExplicitColumns] [TableName("Orders")] [PrimaryKey("Id")] public class Order { [Column] public int Id { get; set; } [Column] public Guid PersonId { get; set; } [Column] public string PoNumber { get; set; } [Column] public DateTime CreatedOn { get; set; } [Column] public string CreatedBy { get; set; } [Column("OrderStatus")] }
[TableName("OrderLines")] [PrimaryKey("Id")] public class OrderLine { [Column] public int Id { get; set; } [Column] public int OrderId { get; set; } [Column(Name = "Qty")] public short Quantity { get; set; } [Column] public decimal SellPrice { get; set; } [ResultColumn] public decimal Total { get; set; } }
[TableName("People")] [PrimaryKey("Id", AutoIncrement = false)] public class Person { [Column] public Guid Id { get; set; } [Column(Name = "FullName")] public string Name { get; set; } [Column] public long Age { get; set; } [Column] public int Height { get; set; } [Column] public DateTime? Dob { get; set; } [Ignore] public string NameAndAge => $"{Name} is of {Age}"; }
[TableName("TransactionLogs")] public class TransactionLog { public string Description { get; set; } public DateTime CreatedOn { get; set; } }