Guest User

Untitled

a guest
Dec 14th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. module DataAccess =
  2. // Would it simplify anything by a lot if WsdlService could generate ServiceTypes as records instead of classes?
  3. type Service40 = WsdlService<My40ServiceUrl>
  4. type Service41 = WsdlService<My41ServiceUrl>
  5. type Service42 = WsdlService<My42ServiceUrl>
  6.  
  7. // All the ticketXXToDomain functions look like they can be less copy-paste, but how?
  8. // Still, I think this F# approach is MUCH better than the mega project we have where WCF SvcUtil.exe
  9. // generate everything for every version and we check that in to source.
  10. module VersionMappers =
  11. module Ticket =
  12. let ticket40ToDomain (t : Service40.ServiceTypes.Ticket) =
  13. MyCSharpProject.Pocos.Ticket(
  14. TicketId = t.TicketId
  15. // with 10+ other fields
  16. TicketType = t.TicketType)
  17. let ticket41ToDomain (t : Service41.ServiceTypes.Ticket) =
  18. MyCSharpProject.Pocos.Ticket(
  19. TicketId = t.TicketId
  20. // with 10+ other fields
  21. TicketType = t.TicketType)
  22. let ticket42ToDomain (t : Service42.ServiceTypes.Ticket) =
  23. MyCSharpProject.Pocos.Ticket(
  24. TicketId = t.TicketId
  25. // with 10+ other fields
  26. TicketType = t.TicketType)
  27.  
  28. module CanThisPseudoCodeBeReal =
  29. type Services =
  30. | V40 of Service40
  31. | V41 of Service41
  32. | V42 of Service42
  33. let ticketToDomain (t : 'a when 'a is one of Services) =
  34. MyCSharpProject.Pocos.Ticket(...)
Add Comment
Please, Sign In to add comment