G
Guest
Hi,
I am kind of new to OO and I have the following problem :
I have a class containing a huge list of functions for accessing an SQL
database.
Public Class Transaction
#region "Client"
Public function GetClientInfos() as Dataset ...
Public sub InsertClientInfos() ...
#end region
#region "Employe"
Public function GetEmployeInfos() as Dataset ...
Public sub InsertEmployeInfos() ...
#end region
...
End Class
However now, those functions could optionnaly call web services instead of
direct sql requests. I thougt of doing something like this, using and
Interface :
Public Interface ITransaction
function GetClientInfos() as Dataset
sub InsertClientInfos()
function GetEmployeInfos() as Dataset ...
sub InsertEmployeInfos() ...
...
End Interface
Public Class TransactionSQL
Implements ITransaction
....
End Class
Public Class TransactionWeb
Implements ITransaction
....
End Class
A call to an instance of this Interface would look like :
Dim transaction as ITransaction
transaction = new TransactionSQL
dgClient.Datasource = transaction.GetClientInfos()
Since there a LOT of functions, I'ld really like to be able to use my
ITransaction Interface, but by adding levels to it. So a call to an
ITransaction instance would look like :
Dim transaction as ITransaction
transaction = new TransactionSQL
dgClient.Datasource = transaction.Client.GetInfos()
dgEmploye.Datasource = transaction.Employe.GetInfos()
How should I implement my classes and interfaces to be able to call my
procedure like that???
Hope it was clear enough
Thx
I am kind of new to OO and I have the following problem :
I have a class containing a huge list of functions for accessing an SQL
database.
Public Class Transaction
#region "Client"
Public function GetClientInfos() as Dataset ...
Public sub InsertClientInfos() ...
#end region
#region "Employe"
Public function GetEmployeInfos() as Dataset ...
Public sub InsertEmployeInfos() ...
#end region
...
End Class
However now, those functions could optionnaly call web services instead of
direct sql requests. I thougt of doing something like this, using and
Interface :
Public Interface ITransaction
function GetClientInfos() as Dataset
sub InsertClientInfos()
function GetEmployeInfos() as Dataset ...
sub InsertEmployeInfos() ...
...
End Interface
Public Class TransactionSQL
Implements ITransaction
....
End Class
Public Class TransactionWeb
Implements ITransaction
....
End Class
A call to an instance of this Interface would look like :
Dim transaction as ITransaction
transaction = new TransactionSQL
dgClient.Datasource = transaction.GetClientInfos()
Since there a LOT of functions, I'ld really like to be able to use my
ITransaction Interface, but by adding levels to it. So a call to an
ITransaction instance would look like :
Dim transaction as ITransaction
transaction = new TransactionSQL
dgClient.Datasource = transaction.Client.GetInfos()
dgEmploye.Datasource = transaction.Employe.GetInfos()
How should I implement my classes and interfaces to be able to call my
procedure like that???
Hope it was clear enough
Thx