Hi there,
this is what i'm trying to achieve, i have separate identical classes for
SqlClient, OracleClient, Odbc and OleDb, what i want is to create a Wrapper
class that calls any of these 4 based on the user connection.... so what i
had in mind was something like this:
Application starts and prompts user to create a database connection.
User selects "Oracle" connect, so i set a parameter in the generic wrapper,
"activeConnection" = oracle (or from enum selection).
Now from here on, i should only have to access the generic wrapper,
eg..something like:
//assuming this is all i need to point the wrapper in the right direction//
GenericDataWrapper x = new GenericDataWrapper();
x.activeConnection = ConnectType.Oracle
x.Connect("connectionstring goes here"...); - we stop here..
So, at the point where x references a procedure, i want the generic wrapper
to go to MyClass.Data.OracleClient.Connect(), if you get the drift of where
i'm coming from.
Does this mean that in the generic class i have to use a switch statement
for every function call, so i point it internally to the right class or is
there a cleaner way with less code here?
any help appreciated.
thanks,
Paul 6 3367
Hi,
"Milsnips" <mi******@hotmail.comwrote in message
news:OC**************@TK2MSFTNGP02.phx.gbl...
Hi there,
this is what i'm trying to achieve, i have separate identical classes for
SqlClient, OracleClient, Odbc and OleDb, what i want is to create a
Wrapper class that calls any of these 4 based on the user connection....
so what i had in mind was something like this:
Have you take a look at the Abstract Factory pattern? http://en.wikipedia.org/wiki/Abstract_factory_pattern
I thnk it will help you
--
Ignacio Machin
machin AT laceupsolutions com
Hi Ignacio,
no i havent seen this. i'll have a look now and hope its what i'm after.
Paul
thanks,
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:Ok*************@TK2MSFTNGP06.phx.gbl...
Hi,
"Milsnips" <mi******@hotmail.comwrote in message
news:OC**************@TK2MSFTNGP02.phx.gbl...
>Hi there,
this is what i'm trying to achieve, i have separate identical classes for SqlClient, OracleClient, Odbc and OleDb, what i want is to create a Wrapper class that calls any of these 4 based on the user connection.... so what i had in mind was something like this:
Have you take a look at the Abstract Factory pattern?
http://en.wikipedia.org/wiki/Abstract_factory_pattern
I thnk it will help you
--
Ignacio Machin
machin AT laceupsolutions com
In addition to the above, if you poke around System.Data, you'll notice
that System.Data.OleDB.OleDBConnection, odbc.odbcConnection,
SqlClient.SqlConnection all derive from the same base type
IdbConnection. Command, recordset, adapter, everything each derive from
a general interface. This is useful as the actual data is agnostic,
DataSet lives in System.Data, so any IdbConnection, etc can be used to
obtain a DataSet.
We don't use oracle here, so I can't confirm their library conforms,
but it would be a bit bloody minded of them not to.
Milsnips wrote:
Hi Ignacio,
no i havent seen this. i'll have a look now and hope its what i'm after.
Paul
thanks,
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:Ok*************@TK2MSFTNGP06.phx.gbl...
Hi,
"Milsnips" <mi******@hotmail.comwrote in message
news:OC**************@TK2MSFTNGP02.phx.gbl...
Hi there,
this is what i'm trying to achieve, i have separate identical classes for
SqlClient, OracleClient, Odbc and OleDb, what i want is to create a
Wrapper class that calls any of these 4 based on the user connection....
so what i had in mind was something like this:
Have you take a look at the Abstract Factory pattern? http://en.wikipedia.org/wiki/Abstract_factory_pattern
I thnk it will help you
--
Ignacio Machin
machin AT laceupsolutions com
Thanks also for your reply. I looked at the abstract factory pattern in the
first reply and its pretty heavy stuff for me, although i think i can half
understand it, but much to go.
This idbConnection seems like what i'm after, i'll see how far i can get
with this.
thanks,
Paul
"DeveloperX" <nn*****@operamail.comwrote in message
news:11*********************@o58g2000hsb.googlegro ups.com...
In addition to the above, if you poke around System.Data, you'll notice
that System.Data.OleDB.OleDBConnection, odbc.odbcConnection,
SqlClient.SqlConnection all derive from the same base type
IdbConnection. Command, recordset, adapter, everything each derive from
a general interface. This is useful as the actual data is agnostic,
DataSet lives in System.Data, so any IdbConnection, etc can be used to
obtain a DataSet.
We don't use oracle here, so I can't confirm their library conforms,
but it would be a bit bloody minded of them not to.
Milsnips wrote:
>Hi Ignacio,
no i havent seen this. i'll have a look now and hope its what i'm after. Paul thanks,
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in message news:Ok*************@TK2MSFTNGP06.phx.gbl...
Hi,
"Milsnips" <mi******@hotmail.comwrote in message
news:OC**************@TK2MSFTNGP02.phx.gbl... Hi there,
this is what i'm trying to achieve, i have separate identical classes for SqlClient, OracleClient, Odbc and OleDb, what i want is to create a Wrapper class that calls any of these 4 based on the user connection.... so what i had in mind was something like this:
Have you take a look at the Abstract Factory pattern?
http://en.wikipedia.org/wiki/Abstract_factory_pattern
I thnk it will help you
--
Ignacio Machin
machin AT laceupsolutions com
EnterpriseLibrary (Data) has already done most of this.
Don't reinvent the wheel.
You can also read this post: http://groups.google.com/group/micro...cbbe0ed0c4519a
or http://groups.google.com/groups/sear...y+&qt_s=Search
find ...
MyDatabaseFactory
"Milsnips" <mi******@hotmail.comwrote in message
news:OC**************@TK2MSFTNGP02.phx.gbl...
Hi there,
this is what i'm trying to achieve, i have separate identical classes for
SqlClient, OracleClient, Odbc and OleDb, what i want is to create a
Wrapper
class that calls any of these 4 based on the user connection.... so what i
had in mind was something like this:
Application starts and prompts user to create a database connection.
User selects "Oracle" connect, so i set a parameter in the generic
wrapper,
"activeConnection" = oracle (or from enum selection).
Now from here on, i should only have to access the generic wrapper,
eg..something like:
//assuming this is all i need to point the wrapper in the right
direction//
GenericDataWrapper x = new GenericDataWrapper();
x.activeConnection = ConnectType.Oracle
x.Connect("connectionstring goes here"...); - we stop here..
So, at the point where x references a procedure, i want the generic
wrapper
to go to MyClass.Data.OracleClient.Connect(), if you get the drift of
where
i'm coming from.
Does this mean that in the generic class i have to use a switch statement
for every function call, so i point it internally to the right class or is
there a cleaner way with less code here?
any help appreciated.
thanks,
Paul
Hi Paul,
you can use the DbProviderFactory and DbPrvoviderFactories classes.
Christof
"Milsnips" <mi******@hotmail.comschrieb im Newsbeitrag
news:OC**************@TK2MSFTNGP02.phx.gbl...
Hi there,
this is what i'm trying to achieve, i have separate identical classes for
SqlClient, OracleClient, Odbc and OleDb, what i want is to create a
Wrapper class that calls any of these 4 based on the user connection....
so what i had in mind was something like this:
Application starts and prompts user to create a database connection.
User selects "Oracle" connect, so i set a parameter in the generic
wrapper, "activeConnection" = oracle (or from enum selection).
Now from here on, i should only have to access the generic wrapper,
eg..something like:
//assuming this is all i need to point the wrapper in the right
direction//
GenericDataWrapper x = new GenericDataWrapper();
x.activeConnection = ConnectType.Oracle
x.Connect("connectionstring goes here"...); - we stop here..
So, at the point where x references a procedure, i want the generic
wrapper to go to MyClass.Data.OracleClient.Connect(), if you get the drift
of where i'm coming from.
Does this mean that in the generic class i have to use a switch statement
for every function call, so i point it internally to the right class or is
there a cleaner way with less code here?
any help appreciated.
thanks,
Paul This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: D Witherspoon |
last post by:
I am developing a Windows Forms application in VB.NET that will use .NET
remoting to access the data tier classes.
A very simple way I have come up with is by creating typed (.xsd) datasets.
For...
|
by: Robin |
last post by:
Are there any generic classes available that can be used in VB.Net to
perform common tasks such as Database Access and Logging?
|
by: mark.moore |
last post by:
I know this has been asked before, but I just can't find the answer in
the sea of hits...
How do you forward declare a class that is *not* paramaterized, but is
based on a template class?
...
|
by: CBFalconer |
last post by:
We often find hidden, and totally unnecessary, assumptions being
made in code. The following leans heavily on one particular
example, which happens to be in C. However similar things can (and...
|
by: markww |
last post by:
Hi,
I have a wrapper around some 3rd party database library function. The
pseudo code looks like the following - it is meant to open a table in a
database, extract values from a table, then copy...
|
by: Steve Richter |
last post by:
in a generic class, can I code the class so that I can call a static
method of the generic class T?
In the ConvertFrom method of the generic TypeConvert class I want to
write, I have a call to...
|
by: phancey |
last post by:
I'm quite new to generics. I have 2 generic classes:
MyClass<Tand MyOtherClass<T>.
MyClass<Thas 2 public Add methods
Add(MyOtherClass<T>);
Add(MyOtherClass<Wrapper<T>>); (Wrapper<Tis another...
|
by: Bob Altman |
last post by:
Hi all,
I want to write a generic class that does this:
Public Class X (Of T)
Public Sub Method(param As T)
dim x as T = param >3
End Sub
End Class
|
by: Rafe |
last post by:
Hi,
I'm working within an application (making a lot of wrappers), but the
application is not case sensitive. For example, Typing obj.name,
obj.Name, or even object.naMe is all fine (as far as...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |