Hi
I in the process of redesigning an existing VB6 app and moving it to VB.NET
2005. At the moment I am just trying to get the architecture right but have
hit a problem that I cant find a satisfactory answer to.
Suppose I have a "MyClassLibrary.Client" class containing some business logic
Public ReadOnly Property Age() As Integer
Get
Age = DateDiff(DateInterval.Year, Dob, DateTime.Today)
End Get
End Property
When i have a webservice that returns type "MyClassLibrary.Client" the type
that I get back at the clientside is "MyWebService.Client". I understand the
reasons behind this but, what I cant find/think of a suitable way around it.
I could do this
Public Function ConvertClient(ByVal WS As MyWebService.Client) As
MyClassLibrary.Client
dim Client as New MyClassLibrary.Client
Client.Forename = WS.Forename
Client.Surname = WS.Surname
.........etc
return Client
End Function
but this is messy and prone to bugs, Its too easy to add a new property to
the class but forget to include it in the conversion routine
Or I have read that you can edit the autogenerated code to get the object
you want, but that you will lose your changes should you update the web
reference.
Neither of these looks very good to me.
Has anyone else come up against the same issue?
How did you get round it?
Is there a recommended way of doing this?
Cheers
--
David Steele
Recent VB6 - Dot net convert