Hi,
I'm pretty new to .Net and I'm trying to work out a way of creating a connection class.
I'm from a Foxpro background and in foxpro I would create a abstract class that represents a connection with all the PEMs required to represent that connection.
I would then create a subclass for use in my application and specify the application specific property settings there.
Now I trying to achieve the same thing in .Net without much success.
Here's what I'm trying to do ;
This would be my abstract class :-
Public Class aConnection : Connection
{
}
and then create a subclass of this in my application with the connection string specified at this level.
Public Class oAppConnection : cConnection
{
This.ConnectionString = "myapplicationspecificsettings"
}
I could then create an instance of this class and the call the open method and I have the desired connection.
The idea being that I would only have to specify the connection setting in one place ie the oAppConnection class.
Having a connection string floating around the place which I pass into a connections open method doesn't seem quite right to me, but I may be wrong...
I would also ideally like to be able to create difference connection strings depending on different database backends. So I could have a factory class that I call and that works out which connection class to instantiate.
Can anybody shed any light on this?
Many Thanks, Bernard......