Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module DataAccess =
- // Would it simplify anything by a lot if WsdlService could generate ServiceTypes as records instead of classes?
- type Service40 = WsdlService<My40ServiceUrl>
- type Service41 = WsdlService<My41ServiceUrl>
- type Service42 = WsdlService<My42ServiceUrl>
- // All the ticketXXToDomain functions look like they can be less copy-paste, but how?
- // Still, I think this F# approach is MUCH better than the mega project we have where WCF SvcUtil.exe
- // generate everything for every version and we check that in to source.
- module VersionMappers =
- module Ticket =
- let ticket40ToDomain (t : Service40.ServiceTypes.Ticket) =
- MyCSharpProject.Pocos.Ticket(
- TicketId = t.TicketId
- // with 10+ other fields
- TicketType = t.TicketType)
- let ticket41ToDomain (t : Service41.ServiceTypes.Ticket) =
- MyCSharpProject.Pocos.Ticket(
- TicketId = t.TicketId
- // with 10+ other fields
- TicketType = t.TicketType)
- let ticket42ToDomain (t : Service42.ServiceTypes.Ticket) =
- MyCSharpProject.Pocos.Ticket(
- TicketId = t.TicketId
- // with 10+ other fields
- TicketType = t.TicketType)
- module CanThisPseudoCodeBeReal =
- type Services =
- | V40 of Service40
- | V41 of Service41
- | V42 of Service42
- let ticketToDomain (t : 'a when 'a is one of Services) =
- MyCSharpProject.Pocos.Ticket(...)
Add Comment
Please, Sign In to add comment