コード例 #1
0
        private void CreateParamsDatabase()
        {
            DatabaseConfig databaseConfig = new DatabaseConfig();

            databaseConfig.configuration = "database_configuration";
            ParamsDatabase paramsDatabase = new ParamsDatabase();

            paramsDatabase.connect = "mongodb://localhost:27017/?minPoolSize=3&maxPoolSize=3";
            paramsDatabase.name    = "dbass";
            databaseConfig.Params  = paramsDatabase;
            diskPresenter.SaveDatabaseConfiguration(databaseConfig);
            Configuration.Instance.ConnectDatabase = databaseConfig.Params.connect;
            Configuration.Instance.NameDatabase    = databaseConfig.Params.name;
            InitDatabase();
        }
コード例 #2
0
 private void btnSaveDatabase_Click(object sender, EventArgs e)
 {
     if (ValidateDatabase())
     {
         DatabaseConfig databaseConfig = new DatabaseConfig();
         databaseConfig.configuration = "database_configuration";
         ParamsDatabase paramsDatabase = new ParamsDatabase();
         paramsDatabase.connect = txtConnect.Text;
         paramsDatabase.name    = txtNameDatabase.Text;
         databaseConfig.Params  = paramsDatabase;
         diskPresenter.SaveDatabaseConfiguration(databaseConfig);
         System.Threading.Thread closeLibrary = new System
                                                .Threading.Thread(new System.Threading
                                                                  .ThreadStart(RequestAipu.Instance.Terminate));
         closeLibrary.Start();
         System.Windows.Forms.Application.Exit();
     }
 }