C
Chris
Can someone tell me the OOP way to code classes for small tables of data?
For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.
Do i need two classes for each of these? A parent and a child class (similar
to tables and table in ado.net) or is there a better way to do it?
See code below...
Thanks,
Chris
BugMonitor.com
Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class
Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16
Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While
Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)),
Category())
Return bCategories
End Function
End Class
For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.
Do i need two classes for each of these? A parent and a child class (similar
to tables and table in ado.net) or is there a better way to do it?
See code below...
Thanks,
Chris
BugMonitor.com
Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class
Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16
Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While
Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)),
Category())
Return bCategories
End Function
End Class