public Service1() { InitializeComponent(); this.BDD = ConnexionSql.getInstance("localhost", "gsb", "root", ""); BDD.openConnection(); }
/** * méthode de création d'une instance de connexion si elle n'existe pas (singleton) */ public static ConnexionSql getInstance(string unProvider, string uneDataBase, string unUid, string unMdp) { lock ((mylock)) { try { if (null == connection) { // Premier appel connection = new ConnexionSql(unProvider, uneDataBase, unUid, unMdp); } } catch (Exception emp) { throw (emp); } return(connection); } }