You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ModelsToDbo.cs 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Luticate2.Utils.Utils;
  2. using TestUtils.DataAccess.Models;
  3. using TestUtils.Dbo.FkPkGuid;
  4. using TestUtils.Dbo.PkBigSerial;
  5. using TestUtils.Dbo.PkGuid;
  6. namespace TestUtils.DataAccess
  7. {
  8. public static class ModelsToDbo
  9. {
  10. public static PkGuidDbo ToDbo(this pk_guid model)
  11. {
  12. if (model == null)
  13. {
  14. return null;
  15. }
  16. return new PkGuidDbo
  17. {
  18. CreatedAt = model.created_at,
  19. UpdatedAt = model.updated_at,
  20. Id = model.id.ToString(),
  21. SomeInt = model.some_int,
  22. SomeText = model.some_text
  23. };
  24. }
  25. public static FkPkGuidDbo ToDbo(this fk_pk_guids model)
  26. {
  27. if (model == null)
  28. {
  29. return null;
  30. }
  31. return new FkPkGuidDbo
  32. {
  33. Id = model.id.ToString(),
  34. Name = model.name,
  35. PkGuid = model.fk_pk_guid.ToDbo(),
  36. PkGuidId = model.pk_guid_id.ToDbo()
  37. };
  38. }
  39. public static PkBigSerialDbo ToDbo(this pk_bigserial model)
  40. {
  41. if (model == null)
  42. {
  43. return null;
  44. }
  45. return new PkBigSerialDbo
  46. {
  47. CreatedAt = model.created_at,
  48. Id = model.id,
  49. SomeInt = model.some_int,
  50. SomeText = model.some_text
  51. };
  52. }
  53. }
  54. }