MySQLFactory.cs

Description du code

MySQLFactory.cs est un fichier du projet BiblioBrol.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/src/.

Projet BiblioBrol :

Gestion de media en CSharp.

Pour plus d'infos, vous pouvez consulter la brève analyse.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Data;
  6. using System.Data.OleDb;
  7. using System.Data.Common;
  8. using System.Configuration;
  9. using be.gaudry.bibliobrol.model.enums;
  10. using be.gaudry.bibliobrol.model.dao.config;
  11. using be.gaudry.bibliobrol.config;
  12. using MySql.Data.MySqlClient;
  13.  
  14. namespace be.gaudry.bibliobrol.model.dao.mysql
  15. {
  16. public class MySQLFactory:DAOFactory
  17. {
  18. private DbProviderFactory dbpf;
  19. private String connStr, provider;
  20. private MySQLConfig dbConfig;
  21. public MySQLFactory()
  22. {
  23. setConnectionSettings();
  24. }
  25.  
  26.  
  27. private void setConnectionSettings()
  28. {
  29. if (dbpf == null)
  30. {
  31. provider = "MySql.Data.MySqlClient";
  32. dbpf = DbProviderFactories.GetFactory(provider);
  33. }
  34. }
  35. public String getConnectionString()
  36. {
  37. /*
  38.   * String conStr = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;UID=root;DATABASE=bibliobrol;Password=;";
  39.   * System.Data.Odbc.OdbcConnection con = new System.Data.Odbc.OdbcConnection(conStr);
  40.   */
  41. if (connStr == null)
  42. {
  43. dbConfig = new MySQLConfig();
  44.  
  45. //connStr = "Provider=MySQL ODBC 5.1 Driver;SERVER=localhost;UID=root;DATABASE=bibliobrol;Password=;";
  46. //MySqlConnectionStringBuilder str = new MySqlConnectionStringBuilder();
  47. //str.Database = "bibliobrol";
  48. //str.Password = "";
  49. //str.Server = "localhost";
  50. //str.UserID = "root";
  51.  
  52. DbConnectionStringBuilder str = new DbConnectionStringBuilder();
  53. //str.Add("Provider", "{MySQL ODBC 5.1 Driver}");//.NET Framework Data Provider for MySQL
  54. str.Add("Data Source", dbConfig.DBUrl);//Data Source or Server ?
  55. str.Add("Database", dbConfig.DBName);
  56. str.Add("User Id", dbConfig.DBUserName);
  57. str.Add("Password", dbConfig.DBPassword);
  58.  
  59. connStr = str.ConnectionString;//server=localhost;user id=root;database=bibliobrol
  60.  
  61. //connStr = "Provider=MySQLProv;Data Source=localhost;User Id=root;Database=bibliobrol;Password=;";
  62.  
  63. }
  64. return connStr;
  65. }
  66.  
  67. public DbProviderFactory getDbpf()
  68. {
  69. return this.dbpf;
  70. }
  71.  
  72. #region getDao methods
  73. public override AbstractDBConfig getDBConfig()
  74. {
  75. return dbConfig;
  76. }
  77.  
  78. public override IConfigDao getConfigDao()
  79. {
  80. return NoChangeConfigDao.Instance;
  81.  
  82. }
  83.  
  84. public override IPersonDao getPersonDao()
  85. {
  86. return NoChangePersonDao.Instance;
  87. }
  88.  
  89. public override IBrolDao getBrolDao()
  90. {
  91. return NoChangeBrolDao.Instance;
  92. }
  93.  
  94. public override IMediaBrolDao getMediaBrolDao()
  95. {
  96. return MySQLMediaBrolDao.Instance;
  97. }
  98.  
  99. public override ITaskDao getTaskDao()
  100. {
  101. return NoChangeTaskDao.Instance;
  102. }
  103.  
  104. public override IExporterDao getExporterDao()
  105. {
  106. return NoChangeExporterDao.Instance;
  107. }
  108.  
  109. public override IImporterDao getImporterDao()
  110. {
  111. return NoChangeImporterDao.Instance;
  112. }
  113.  
  114. public override IStatsDao getStatsDao()
  115. {
  116. return MySQLStatsDao.Instance;
  117. }
  118.  
  119. public override ISerieDao getSerieDao()
  120. {
  121. return NoChangeSerieDao.Instance;
  122. }
  123. #endregion
  124. }
  125. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/src/model/dao/mysql/ 
IcôneNomTailleModification
IcôneNomTailleModification
| _ Répertoire parent0 octets1719994713 03/07/2024 10:18:33
| _utils0 octets1541007203 31/10/2018 18:33:23
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/src/model/dao/mysql/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csNoChangeImporterDao.cs27.14 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csNoChangeExporterDao.cs33.69 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csNoChangeSerieDao.cs6.22 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csMySQLFactory.cs3.75 Ko31/10/2018 18:33:17-refusé-
Afficher le fichier .cs|.csNoChangeConfigDao.cs12.25 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csNoChangePersonDao.cs59.9 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csNoChangeTaskDao.cs8.92 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csNoChangeBrolDao.cs58.25 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csMySQLStatsDao.cs10.63 Ko31/10/2018 18:33:18-refusé-
Afficher le fichier .cs|.csMySQLMediaBrolDao.cs50.51 Ko31/10/2018 18:33:18-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Document créé le 16/10/2009, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/cs-bibliobrol-source-rf-model/dao/mysql/MySQLFactory.cs.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.