/PetaPoco.Tests/poco.cs

http://github.com/toptensoftware/PetaPoco · C# · 86 lines · 75 code · 7 blank · 4 comment · 0 complexity · 42d3b250c4b0eb70e6f8764079bd277b MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using PetaPoco;
  6. namespace PetaPoco.Tests
  7. {
  8. enum State
  9. {
  10. Yes,
  11. No,
  12. Maybe,
  13. }
  14. // Non-decorated true poco
  15. class poco
  16. {
  17. public long id { get; set; }
  18. public string title { get; set; }
  19. public bool draft { get; set; }
  20. public DateTime date_created { get; set; }
  21. public DateTime? date_edited { get; set; }
  22. public string content { get; set; }
  23. public State state { get; set; }
  24. [Column("col w space")] public int col_w_space { get; set; }
  25. public float? nullreal { get; set; }
  26. }
  27. // Attributed not-so-true poco
  28. [TableName("petapoco")]
  29. [PrimaryKey("id", sequenceName="article_id_seq")]
  30. [ExplicitColumns]
  31. class deco
  32. {
  33. [Column] public long id { get; set; }
  34. [Column] public string title { get; set; }
  35. [Column] public bool draft { get; set; }
  36. [Column] public DateTime date_created { get; set; }
  37. [Column] public DateTime? date_edited { get; set; }
  38. [Column] public string content { get; set; }
  39. [Column] public State state { get; set; }
  40. [Column("col w space")] public int col_w_space { get; set; }
  41. [Column] public float? nullreal { get; set; }
  42. }
  43. // Attributed not-so-true poco
  44. [TableName("petapoco")]
  45. [PrimaryKey("id")]
  46. [ExplicitColumns]
  47. class deco_explicit
  48. {
  49. [Column]public long id { get; set; }
  50. [Column]public string title { get; set; }
  51. [Column]public bool draft { get; set; }
  52. [Column]public DateTime date_created { get; set; }
  53. [Column]public State state { get; set; }
  54. public string content { get; set; }
  55. [Column("col w space")]public int col_w_space { get; set; }
  56. [Column] public float? nullreal { get; set; }
  57. }
  58. // Attributed not-so-true poco
  59. [TableName("petapoco")]
  60. [PrimaryKey("id")]
  61. class deco_non_explicit
  62. {
  63. public long id { get; set; }
  64. public string title { get; set; }
  65. public bool draft { get; set; }
  66. public DateTime date_created { get; set; }
  67. public State state { get; set; }
  68. [Ignore] public string content { get; set; }
  69. [Column("col w space")] public int col_w_space { get; set; }
  70. public float? nullreal { get; set; }
  71. }
  72. [TableName("petapoco2")]
  73. [PrimaryKey("email", autoIncrement=false)]
  74. class petapoco2
  75. {
  76. public string email { get; set; }
  77. public string name { get; set; }
  78. }
  79. }