I am trying to build a generic connection class using DbProviderFactory, DbConnection and other abstract classes in System.Data.Common
I noticed that both DbProviderFactory and DbConnection have method to Create Command.
If I intend to implement Singleton pattern, on which object is it advisable (on DbProviderFactory object or DbConnection object)?
 
                        
You use the
DbProviderFactoriesclass to produce aDBProviderFactoryfor your chosen connector. Using this, and your connection string, you create aDbConnection. With thisDbConnectionyou can create yourDbCommandand use theDbProviderFactoryto create yourParameterand add them. There's no need for a singleton.