As mentioned in this question, I am moving our team towards objects (as opposed to just throwing DataTables and variables around everywhere). I have picked a suitable spot for the project that contains the object definitions, but not sure how I should go about populating some of the objects. In particular, what do I do with classes as properties?
Public Class Class1 Public Property SomeProperty As String Public Property SomeOtherProperty As String Public Property SomeKey As Integer Public Property Foo As Class2 End Class
In this basic example, I can easily populate the first three properties from a query, but
Foo has its own set of properties. Right now, to create a
List(Of Class1) I generate the data for all of the Class1 objects, and then use
SomeKey to go back and, one object at a time, populate all of the
Foo. Certainly this works, but in my case it is rather slow, and it seems that perhaps I am simply doing it wrong.
Am I handling that incorrectly? If so, what should I be doing? The only other thing I can come up with is to create a query (or stored procedure) that returns all of the appropriate data for all of the objects. In my test case that amounts to a list that contains 154
Class1's, with each of them having four properties like
Foo, and some of those having classes as properties.