J
jc
RE: Why use a CollectionBase class here vs dataset or dataview?
I'm looking at some vb.net 2005 code that was generated from a
homegrown Codesmith Template that generate all of the retreival and
update code for typical vb.net / asp.net data maintenance
applications. For some reason they have two class files for each
table, one is a collection class. Oddly both have the same properties
for each table column duplicated.. a lot of duplicate code and I'm
trying to understand why. Also, I'm trying to explain why the use of a
collection class anyways.
Perhaps the motivation was a more pure OOP approach, or perhaps
eventual scalability.
1. why the two classes?
Imports System.Configuration.ConfigurationManager
Namespace WH
Public Class Collaborator
Private m_ColId As Integer
Private m_Lastname As String
Get
Return m_ColId
End Get
Set(ByVal value As Integer)
m_ColId = value
End Set
End Property
and the other like this:
Namespace WH
Public Class colCollaborator
Inherits System.Collections.CollectionBase
#Region "List Data Structure"
Public Structure s_Collaborator
Private m_Result As String
Public Property ColId() As Integer
Get
Return m_ColId
End Get
Set(ByVal value As Integer)
m_ColId = value
End Set
End Property
Can't they be combined?
2. Sorry for the potentially noob OOP question, but why even use a
collection class? Any way to have a class that stores a dataset or a
dataview? And if not and a valid reason for the collection class, why
not one class file and one set of properties? The collection class
uses a reader to load the collection list..
Me.List.Add(FromDataReader(oRdr, blnAdd0Index))
Thanks for any help or information!
I'm looking at some vb.net 2005 code that was generated from a
homegrown Codesmith Template that generate all of the retreival and
update code for typical vb.net / asp.net data maintenance
applications. For some reason they have two class files for each
table, one is a collection class. Oddly both have the same properties
for each table column duplicated.. a lot of duplicate code and I'm
trying to understand why. Also, I'm trying to explain why the use of a
collection class anyways.
Perhaps the motivation was a more pure OOP approach, or perhaps
eventual scalability.
1. why the two classes?
Imports System.Configuration.ConfigurationManager
Namespace WH
Public Class Collaborator
Private m_ColId As Integer
Private m_Lastname As String
Get
Return m_ColId
End Get
Set(ByVal value As Integer)
m_ColId = value
End Set
End Property
and the other like this:
Namespace WH
Public Class colCollaborator
Inherits System.Collections.CollectionBase
#Region "List Data Structure"
Public Structure s_Collaborator
Private m_Result As String
Public Property ColId() As Integer
Get
Return m_ColId
End Get
Set(ByVal value As Integer)
m_ColId = value
End Set
End Property
Can't they be combined?
2. Sorry for the potentially noob OOP question, but why even use a
collection class? Any way to have a class that stores a dataset or a
dataview? And if not and a valid reason for the collection class, why
not one class file and one set of properties? The collection class
uses a reader to load the collection list..
Me.List.Add(FromDataReader(oRdr, blnAdd0Index))
Thanks for any help or information!