473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Deriving from Abstract Classes with Enums and Varying Object Types

I'm converting an app written in VB 2003 to 2005 and need advice for how to
deal with this situation:

The app has a number of "manager" classes that handle the data access. They
all have several routines that are identical, except for the object type and
database action specific to that particular class, such as "Public ReadOnly
Property Item(ByVal SystemID As Integer) As CEmployee" or "Public Shared
Function Save(ByVal TheItem As CEmployee) As Boolean". Each of the object
classes also have a bunch of common properties and methods that are
inherited from an abstract base class.

What I want to do with the manager classes is rewrite them using an abstract
class with MustOverride properties and methods. Where I'm hung up is the
existing implementation uses an Enum that defines the database field names
and ordinal positions in the SELECT statement used to create the datareader.
For example:

Public Class EmployeeManager

Public Enum MyFields
NameSystemID = 0
NameFirst
NameMiddle
NameLast
DateHired
RecStatus
RecDateAdd
RecDateRev
RecAddBy
RecRevBy
End Enum

Private Shared _FieldList As ArrayList = Nothing
Public Shared ReadOnly Property FieldList() As ArrayList
Get
If _FieldList Is Nothing Then
_FieldList = New ArrayList
Dim arNames() As String
arNames = MyFields.GetNames(GetType(MyFields))
For x As Integer = 0 To arNames.GetUpperBound(0)
_FieldList.Add(New VisarEnumBindingItem(EnumValue:=x,
EnumLabel:=arNames(x))
Next
End If
Return _FieldList
End Get
End Property

Private Shared _FieldListString As String = ""
Public Shared ReadOnly Property FieldListString() As String
Get
If _FieldListString = "" Then
Dim ThisItem As VisarEnumBindingItem = Nothing
For x As Integer = 0 To FieldList.Count -1
ThisItem = CType(_FieldList(x), VisarEnumBindingItem)
_FieldListString += ThisItem.StringValue & ", "
Next
_FieldListString = Left(_FieldListString,
_FieldListString.LastIndexOf(", "))
End If
Return _FieldListString
End Get
End Property

' Overloaded Item property creates a command to retrieve by PK or AK,
passes command to ItemFetch, which in turn calls ItemFill to unpack the
datareader into the instance object and pass it back up the chain.

Private Shared Function ItemFill(ByVal ItemReader As OleDbDataReader) As
CEmployee
With ItemReader
Return New CEmployee(RecSystemID:=.GetInt32(MyFields.NameSyst emID),
RecStatus:=VisarGoodies.MakeInt32(.GetValue(MyFiel ds.RecStatus)),
RecDateAdd:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateAdd)),
RecDateRev:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateRev)),
RecAddBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecAddBy)),
RecRevBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecRevBy)),
NameFirst:=VisarGoodies.MakeString(.GetValue(MyFie lds.NameFirst)),
NameMiddle:=VisarGoodies.MakeString(.GetValue(MyFi elds.NameMiddle)),
NameLast:=VisarGoodies.MakeString(.GetValue(MyFiel ds.NameLast)))
End With
End Function

End Class

The way it's designed, changes to the order of fields in the select
statement or even actual field names only need to be made in the Enum. The
select, insert, and update statements are dynamically constructed in each of
the managers from the FieldList arraylist.

How can I create the identical functionality using an abstract class in
VB2005, also placing the code that constructs the "FieldList" from the Enum
into a shared method in a separate utility class? I tried using a
placeholder enum and the FieldList property in the base class, and a
shadowed enum in a derived class, but when executed, it uses the base enum,
not the shadowed one. It does work when place the enum and override
FieldList in each of the derived classes but I don't want to implement
identical code over and over.

Thanks,

Gino
Jul 19 '06 #1
4 1247
Well I'm confused.....

Is all this just for the purpose of selecting, updating, inserting
records to and from a database?

If so then I'd say this is in major need of a rewrite. Why make things
harder than they need to be?
Confused Newbie wrote:
I'm converting an app written in VB 2003 to 2005 and need advice for how to
deal with this situation:

The app has a number of "manager" classes that handle the data access. They
all have several routines that are identical, except for the object type and
database action specific to that particular class, such as "Public ReadOnly
Property Item(ByVal SystemID As Integer) As CEmployee" or "Public Shared
Function Save(ByVal TheItem As CEmployee) As Boolean". Each of the object
classes also have a bunch of common properties and methods that are
inherited from an abstract base class.

What I want to do with the manager classes is rewrite them using an abstract
class with MustOverride properties and methods. Where I'm hung up is the
existing implementation uses an Enum that defines the database field names
and ordinal positions in the SELECT statement used to create the datareader.
For example:

Public Class EmployeeManager

Public Enum MyFields
NameSystemID = 0
NameFirst
NameMiddle
NameLast
DateHired
RecStatus
RecDateAdd
RecDateRev
RecAddBy
RecRevBy
End Enum

Private Shared _FieldList As ArrayList = Nothing
Public Shared ReadOnly Property FieldList() As ArrayList
Get
If _FieldList Is Nothing Then
_FieldList = New ArrayList
Dim arNames() As String
arNames = MyFields.GetNames(GetType(MyFields))
For x As Integer = 0 To arNames.GetUpperBound(0)
_FieldList.Add(New VisarEnumBindingItem(EnumValue:=x,
EnumLabel:=arNames(x))
Next
End If
Return _FieldList
End Get
End Property

Private Shared _FieldListString As String = ""
Public Shared ReadOnly Property FieldListString() As String
Get
If _FieldListString = "" Then
Dim ThisItem As VisarEnumBindingItem = Nothing
For x As Integer = 0 To FieldList.Count -1
ThisItem = CType(_FieldList(x), VisarEnumBindingItem)
_FieldListString += ThisItem.StringValue & ", "
Next
_FieldListString = Left(_FieldListString,
_FieldListString.LastIndexOf(", "))
End If
Return _FieldListString
End Get
End Property

' Overloaded Item property creates a command to retrieve by PK or AK,
passes command to ItemFetch, which in turn calls ItemFill to unpack the
datareader into the instance object and pass it back up the chain.

Private Shared Function ItemFill(ByVal ItemReader As OleDbDataReader) As
CEmployee
With ItemReader
Return New CEmployee(RecSystemID:=.GetInt32(MyFields.NameSyst emID),
RecStatus:=VisarGoodies.MakeInt32(.GetValue(MyFiel ds.RecStatus)),
RecDateAdd:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateAdd)),
RecDateRev:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateRev)),
RecAddBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecAddBy)),
RecRevBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecRevBy)),
NameFirst:=VisarGoodies.MakeString(.GetValue(MyFie lds.NameFirst)),
NameMiddle:=VisarGoodies.MakeString(.GetValue(MyFi elds.NameMiddle)),
NameLast:=VisarGoodies.MakeString(.GetValue(MyFiel ds.NameLast)))
End With
End Function

End Class

The way it's designed, changes to the order of fields in the select
statement or even actual field names only need to be made in the Enum. The
select, insert, and update statements are dynamically constructed in each of
the managers from the FieldList arraylist.

How can I create the identical functionality using an abstract class in
VB2005, also placing the code that constructs the "FieldList" from the Enum
into a shared method in a separate utility class? I tried using a
placeholder enum and the FieldList property in the base class, and a
shadowed enum in a derived class, but when executed, it uses the base enum,
not the shadowed one. It does work when place the enum and override
FieldList in each of the derived classes but I don't want to implement
identical code over and over.

Thanks,

Gino
Jul 19 '06 #2
The manager classes I'm rewriting perform numerous other tasks and all of
our in-house apps are built around them. They're quite simple and elegant
considering all the heavy lifting they have to do. If you think this design
is wrong, then please post an exact example of how you would rewrite them.
Just saying it's harder than it need be and needs a major rewrite is not in
the least bit helpful.

"Izzy" <is************@gmail.comwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Well I'm confused.....

Is all this just for the purpose of selecting, updating, inserting
records to and from a database?

If so then I'd say this is in major need of a rewrite. Why make things
harder than they need to be?
Confused Newbie wrote:
>I'm converting an app written in VB 2003 to 2005 and need advice for how
to
deal with this situation:

The app has a number of "manager" classes that handle the data access.
They
all have several routines that are identical, except for the object type
and
database action specific to that particular class, such as "Public
ReadOnly
Property Item(ByVal SystemID As Integer) As CEmployee" or "Public Shared
Function Save(ByVal TheItem As CEmployee) As Boolean". Each of the
object
classes also have a bunch of common properties and methods that are
inherited from an abstract base class.

What I want to do with the manager classes is rewrite them using an
abstract
class with MustOverride properties and methods. Where I'm hung up is the
existing implementation uses an Enum that defines the database field
names
and ordinal positions in the SELECT statement used to create the
datareader.
For example:

Public Class EmployeeManager

Public Enum MyFields
NameSystemID = 0
NameFirst
NameMiddle
NameLast
DateHired
RecStatus
RecDateAdd
RecDateRev
RecAddBy
RecRevBy
End Enum

Private Shared _FieldList As ArrayList = Nothing
Public Shared ReadOnly Property FieldList() As ArrayList
Get
If _FieldList Is Nothing Then
_FieldList = New ArrayList
Dim arNames() As String
arNames = MyFields.GetNames(GetType(MyFields))
For x As Integer = 0 To arNames.GetUpperBound(0)
_FieldList.Add(New VisarEnumBindingItem(EnumValue:=x,
EnumLabel:=arNames(x))
Next
End If
Return _FieldList
End Get
End Property

Private Shared _FieldListString As String = ""
Public Shared ReadOnly Property FieldListString() As String
Get
If _FieldListString = "" Then
Dim ThisItem As VisarEnumBindingItem = Nothing
For x As Integer = 0 To FieldList.Count -1
ThisItem = CType(_FieldList(x), VisarEnumBindingItem)
_FieldListString += ThisItem.StringValue & ", "
Next
_FieldListString = Left(_FieldListString,
_FieldListString.LastIndexOf(", "))
End If
Return _FieldListString
End Get
End Property

' Overloaded Item property creates a command to retrieve by PK or AK,
passes command to ItemFetch, which in turn calls ItemFill to unpack the
datareader into the instance object and pass it back up the chain.

Private Shared Function ItemFill(ByVal ItemReader As OleDbDataReader)
As
CEmployee
With ItemReader
Return New
CEmployee(RecSystemID:=.GetInt32(MyFields.NameSys temID),
RecStatus:=VisarGoodies.MakeInt32(.GetValue(MyFie lds.RecStatus)),
RecDateAdd:=VisarGoodies.MakeDate(.GetValue(MyFie lds.RecDateAdd)),
RecDateRev:=VisarGoodies.MakeDate(.GetValue(MyFie lds.RecDateRev)),
RecAddBy:=VisarGoodies.MakeInt32(.GetValue(MyFiel ds.RecAddBy)),
RecRevBy:=VisarGoodies.MakeInt32(.GetValue(MyFiel ds.RecRevBy)),
NameFirst:=VisarGoodies.MakeString(.GetValue(MyFi elds.NameFirst)),
NameMiddle:=VisarGoodies.MakeString(.GetValue(MyF ields.NameMiddle)),
NameLast:=VisarGoodies.MakeString(.GetValue(MyFie lds.NameLast)))
End With
End Function

End Class

The way it's designed, changes to the order of fields in the select
statement or even actual field names only need to be made in the Enum.
The
select, insert, and update statements are dynamically constructed in each
of
the managers from the FieldList arraylist.

How can I create the identical functionality using an abstract class in
VB2005, also placing the code that constructs the "FieldList" from the
Enum
into a shared method in a separate utility class? I tried using a
placeholder enum and the FieldList property in the base class, and a
shadowed enum in a derived class, but when executed, it uses the base
enum,
not the shadowed one. It does work when place the enum and override
FieldList in each of the derived classes but I don't want to implement
identical code over and over.

Thanks,

Gino

Jul 19 '06 #3
Confused Newbie,
I would consider using a Generic class, passing the Enum & object type as
type parameters

Something like:

Dim employeManager as New Manager(Of Employee, Employee.MyFields)

The "trick" is the implementation of ItemFill, as you need the constructor
to Employee, generally I make Manager a base class...

Alternatively you could define "Manager" as a shared member of Employee
itself:

Public Class Employee

Public Shared ReadOnly Manager As New EmployeeManager()

Public Enum MyFields
NameSystemID = 0
NameFirst
NameMiddle
NameLast
DateHired
RecStatus
RecDateAdd
RecDateRev
RecAddBy
RecRevBy
End Enum

End Class

Public Class EmployeeManager
Inherits Manager(Of Employee, Employee.MyFields)

End Class

Where Manager is defined something like:

Public MustInherit Class Manager(Of T As Class, F)

Private _FieldList As ArrayList = Nothing
Public ReadOnly Property FieldList() As ArrayList
Get
If _FieldList Is Nothing Then
_FieldList = New ArrayList
Dim arNames() As String
arNames = [Enum].GetNames(GetType(F))
For x As Integer = 0 To arNames.GetUpperBound(0)
_FieldList.Add(New
VisarEnumBindingItem(EnumValue:=x, EnumLabel:=arNames(x)))
Next
End If
Return _FieldList
End Get
End Property

Private _FieldListString As String = ""
Public ReadOnly Property FieldListString() As String
Get
If _FieldListString = "" Then
Dim ThisItem As VisarEnumBindingItem = Nothing
For x As Integer = 0 To FieldList.Count - 1
ThisItem = CType(_FieldList(x),
VisarEnumBindingItem)
_FieldListString += ThisItem.StringValue & ", "
Next
_FieldListString = Left(_FieldListString,
_FieldListString.LastIndexOf(", "))
End If
Return _FieldListString
End Get
End Property

Public MustOverride Function ItemFill(ByVal ItemReader As
OleDbDataReader) As T

End Class

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Confused Newbie" <no**@spam.duhwrote in message
news:uU**************@TK2MSFTNGP03.phx.gbl...
| I'm converting an app written in VB 2003 to 2005 and need advice for how
to
| deal with this situation:
|
| The app has a number of "manager" classes that handle the data access.
They
| all have several routines that are identical, except for the object type
and
| database action specific to that particular class, such as "Public
ReadOnly
| Property Item(ByVal SystemID As Integer) As CEmployee" or "Public Shared
| Function Save(ByVal TheItem As CEmployee) As Boolean". Each of the object
| classes also have a bunch of common properties and methods that are
| inherited from an abstract base class.
|
| What I want to do with the manager classes is rewrite them using an
abstract
| class with MustOverride properties and methods. Where I'm hung up is the
| existing implementation uses an Enum that defines the database field names
| and ordinal positions in the SELECT statement used to create the
datareader.
| For example:
|
| Public Class EmployeeManager
|
| Public Enum MyFields
| NameSystemID = 0
| NameFirst
| NameMiddle
| NameLast
| DateHired
| RecStatus
| RecDateAdd
| RecDateRev
| RecAddBy
| RecRevBy
| End Enum
|
| Private Shared _FieldList As ArrayList = Nothing
| Public Shared ReadOnly Property FieldList() As ArrayList
| Get
| If _FieldList Is Nothing Then
| _FieldList = New ArrayList
| Dim arNames() As String
| arNames = MyFields.GetNames(GetType(MyFields))
| For x As Integer = 0 To arNames.GetUpperBound(0)
| _FieldList.Add(New VisarEnumBindingItem(EnumValue:=x,
| EnumLabel:=arNames(x))
| Next
| End If
| Return _FieldList
| End Get
| End Property
|
| Private Shared _FieldListString As String = ""
| Public Shared ReadOnly Property FieldListString() As String
| Get
| If _FieldListString = "" Then
| Dim ThisItem As VisarEnumBindingItem = Nothing
| For x As Integer = 0 To FieldList.Count -1
| ThisItem = CType(_FieldList(x), VisarEnumBindingItem)
| _FieldListString += ThisItem.StringValue & ", "
| Next
| _FieldListString = Left(_FieldListString,
| _FieldListString.LastIndexOf(", "))
| End If
| Return _FieldListString
| End Get
| End Property
|
| ' Overloaded Item property creates a command to retrieve by PK or AK,
| passes command to ItemFetch, which in turn calls ItemFill to unpack the
| datareader into the instance object and pass it back up the chain.
|
| Private Shared Function ItemFill(ByVal ItemReader As OleDbDataReader) As
| CEmployee
| With ItemReader
| Return New CEmployee(RecSystemID:=.GetInt32(MyFields.NameSyst emID),
| RecStatus:=VisarGoodies.MakeInt32(.GetValue(MyFiel ds.RecStatus)),
| RecDateAdd:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateAdd)),
| RecDateRev:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateRev)),
| RecAddBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecAddBy)),
| RecRevBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecRevBy)),
| NameFirst:=VisarGoodies.MakeString(.GetValue(MyFie lds.NameFirst)),
| NameMiddle:=VisarGoodies.MakeString(.GetValue(MyFi elds.NameMiddle)),
| NameLast:=VisarGoodies.MakeString(.GetValue(MyFiel ds.NameLast)))
| End With
| End Function
|
| End Class
|
| The way it's designed, changes to the order of fields in the select
| statement or even actual field names only need to be made in the Enum.
The
| select, insert, and update statements are dynamically constructed in each
of
| the managers from the FieldList arraylist.
|
| How can I create the identical functionality using an abstract class in
| VB2005, also placing the code that constructs the "FieldList" from the
Enum
| into a shared method in a separate utility class? I tried using a
| placeholder enum and the FieldList property in the base class, and a
| shadowed enum in a derived class, but when executed, it uses the base
enum,
| not the shadowed one. It does work when place the enum and override
| FieldList in each of the derived classes but I don't want to implement
| identical code over and over.
|
| Thanks,
|
| Gino
|
|
Jul 19 '06 #4
Thanks so much, Jay! This is what I was looking for. I couldn't for the
life of me remember generics classes yesterday, even with BindingList
staring me right in the face.

Gino
"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.netwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
Confused Newbie,
I would consider using a Generic class, passing the Enum & object type as
type parameters

Something like:

Dim employeManager as New Manager(Of Employee, Employee.MyFields)

The "trick" is the implementation of ItemFill, as you need the constructor
to Employee, generally I make Manager a base class...

Alternatively you could define "Manager" as a shared member of Employee
itself:

Public Class Employee

Public Shared ReadOnly Manager As New EmployeeManager()

Public Enum MyFields
NameSystemID = 0
NameFirst
NameMiddle
NameLast
DateHired
RecStatus
RecDateAdd
RecDateRev
RecAddBy
RecRevBy
End Enum

End Class

Public Class EmployeeManager
Inherits Manager(Of Employee, Employee.MyFields)

End Class

Where Manager is defined something like:

Public MustInherit Class Manager(Of T As Class, F)

Private _FieldList As ArrayList = Nothing
Public ReadOnly Property FieldList() As ArrayList
Get
If _FieldList Is Nothing Then
_FieldList = New ArrayList
Dim arNames() As String
arNames = [Enum].GetNames(GetType(F))
For x As Integer = 0 To arNames.GetUpperBound(0)
_FieldList.Add(New
VisarEnumBindingItem(EnumValue:=x, EnumLabel:=arNames(x)))
Next
End If
Return _FieldList
End Get
End Property

Private _FieldListString As String = ""
Public ReadOnly Property FieldListString() As String
Get
If _FieldListString = "" Then
Dim ThisItem As VisarEnumBindingItem = Nothing
For x As Integer = 0 To FieldList.Count - 1
ThisItem = CType(_FieldList(x),
VisarEnumBindingItem)
_FieldListString += ThisItem.StringValue & ", "
Next
_FieldListString = Left(_FieldListString,
_FieldListString.LastIndexOf(", "))
End If
Return _FieldListString
End Get
End Property

Public MustOverride Function ItemFill(ByVal ItemReader As
OleDbDataReader) As T

End Class

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Confused Newbie" <no**@spam.duhwrote in message
news:uU**************@TK2MSFTNGP03.phx.gbl...
| I'm converting an app written in VB 2003 to 2005 and need advice for how
to
| deal with this situation:
|
| The app has a number of "manager" classes that handle the data access.
They
| all have several routines that are identical, except for the object type
and
| database action specific to that particular class, such as "Public
ReadOnly
| Property Item(ByVal SystemID As Integer) As CEmployee" or "Public Shared
| Function Save(ByVal TheItem As CEmployee) As Boolean". Each of the
object
| classes also have a bunch of common properties and methods that are
| inherited from an abstract base class.
|
| What I want to do with the manager classes is rewrite them using an
abstract
| class with MustOverride properties and methods. Where I'm hung up is
the
| existing implementation uses an Enum that defines the database field
names
| and ordinal positions in the SELECT statement used to create the
datareader.
| For example:
|
| Public Class EmployeeManager
|
| Public Enum MyFields
| NameSystemID = 0
| NameFirst
| NameMiddle
| NameLast
| DateHired
| RecStatus
| RecDateAdd
| RecDateRev
| RecAddBy
| RecRevBy
| End Enum
|
| Private Shared _FieldList As ArrayList = Nothing
| Public Shared ReadOnly Property FieldList() As ArrayList
| Get
| If _FieldList Is Nothing Then
| _FieldList = New ArrayList
| Dim arNames() As String
| arNames = MyFields.GetNames(GetType(MyFields))
| For x As Integer = 0 To arNames.GetUpperBound(0)
| _FieldList.Add(New VisarEnumBindingItem(EnumValue:=x,
| EnumLabel:=arNames(x))
| Next
| End If
| Return _FieldList
| End Get
| End Property
|
| Private Shared _FieldListString As String = ""
| Public Shared ReadOnly Property FieldListString() As String
| Get
| If _FieldListString = "" Then
| Dim ThisItem As VisarEnumBindingItem = Nothing
| For x As Integer = 0 To FieldList.Count -1
| ThisItem = CType(_FieldList(x), VisarEnumBindingItem)
| _FieldListString += ThisItem.StringValue & ", "
| Next
| _FieldListString = Left(_FieldListString,
| _FieldListString.LastIndexOf(", "))
| End If
| Return _FieldListString
| End Get
| End Property
|
| ' Overloaded Item property creates a command to retrieve by PK or AK,
| passes command to ItemFetch, which in turn calls ItemFill to unpack the
| datareader into the instance object and pass it back up the chain.
|
| Private Shared Function ItemFill(ByVal ItemReader As OleDbDataReader)
As
| CEmployee
| With ItemReader
| Return New
CEmployee(RecSystemID:=.GetInt32(MyFields.NameSyst emID),
| RecStatus:=VisarGoodies.MakeInt32(.GetValue(MyFiel ds.RecStatus)),
| RecDateAdd:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateAdd)),
| RecDateRev:=VisarGoodies.MakeDate(.GetValue(MyFiel ds.RecDateRev)),
| RecAddBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecAddBy)),
| RecRevBy:=VisarGoodies.MakeInt32(.GetValue(MyField s.RecRevBy)),
| NameFirst:=VisarGoodies.MakeString(.GetValue(MyFie lds.NameFirst)),
| NameMiddle:=VisarGoodies.MakeString(.GetValue(MyFi elds.NameMiddle)),
| NameLast:=VisarGoodies.MakeString(.GetValue(MyFiel ds.NameLast)))
| End With
| End Function
|
| End Class
|
| The way it's designed, changes to the order of fields in the select
| statement or even actual field names only need to be made in the Enum.
The
| select, insert, and update statements are dynamically constructed in
each
of
| the managers from the FieldList arraylist.
|
| How can I create the identical functionality using an abstract class in
| VB2005, also placing the code that constructs the "FieldList" from the
Enum
| into a shared method in a separate utility class? I tried using a
| placeholder enum and the FieldList property in the base class, and a
| shadowed enum in a derived class, but when executed, it uses the base
enum,
| not the shadowed one. It does work when place the enum and override
| FieldList in each of the derived classes but I don't want to implement
| identical code over and over.
|
| Thanks,
|
| Gino
|
|


Jul 20 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
2
by: Julian | last post by:
I would like to have output from my program to be written to cout as well as a file. (actually, i want several other output options but this should explain my problem in the simplest way). I have...
3
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
33
by: Chris Capel | last post by:
What is the rationale behind the decision not to allow abstract static class members? It doesn't seem like it's a logically contradictory concept, or that the implementation would be difficult or...
5
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
2
by: Julia | last post by:
Hi, I have an application composed from layers like the following A --B ---C A is the top layer C uses an Abstract Factory to Create Concrete classes
6
by: Alden Pierre | last post by:
Hello, http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7 As per the link above it's wise to have a virtual deconstructor when creating an abstract class. Here is when I'm...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
20
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.