namespace AV.Connections
{
protected class MyConnection
{
protected ConnectionStringSettings connectionSettings
{
get { return ConfigurationManager.ConnectionStrings["mySQLConnection"]; }
}
protected DbConnection connection
{
get { return new OdbcConnection(connectionSettings.ConnectionString); }
}
protected DbCommand command
{
get { return connection.CreateCommand(); }
}
protected DbParameter parameter
{
get { return command.CreateParameter(); }
}
}
}
I was trying to create singleton class which could return connection objects as well as other related objects. The above was the approach I thought of. I am sure I am wrong somehow. Please point out the how? Or if not what's the best approach for this.
This is not Singleton....I understand but I think I can't declare the class static as it involves connections. So I am really confused about this situation.