예제 #1
0
        /// <summary>
        /// Generates a connection string from the given database credinitials.
        /// </summary>
        /// <param name="database">The database the conection will connect to.</param>
        /// <param name="server">The database server credenitials.</param>
        /// <returns>Returns a string holding the generated connection string.</returns>
        private static string GenerateConnectionString(SqlDatabase database, SqlDatabaseServer server)
        {
            MySqlConnectionStringBuilder csb = new MySqlConnectionStringBuilder();

            // Database.
            csb.Database        = database.Name;
            csb.MinimumPoolSize = database.MinPoolSize;
            csb.MaximumPoolSize = database.MaxPoolSize;

            // Server.
            csb.Server   = server.Host;
            csb.Port     = server.Port;
            csb.UserID   = server.User;
            csb.Password = server.Password;

            return(csb.ToString());
        }
예제 #2
0
        /// <summary>
        /// Destroys the management.
        /// </summary>
        public void Destroy()
        {
            lock (this.lockObject)
            {
                for (int i = 0; i < this.clients.Length; i++)
                {
                    this.clients[i].Destroy();
                    this.clients[i] = null;
                }
            }

            this.server           = null;
            this.database         = null;
            this.clients          = null;
            this.availibleClients = null;

            StopMonitor();
            this.monitor = null;
        }
예제 #3
0
 /// <summary>
 /// Constructs a new SqlDatabaseManager with the specified database to
 /// work with, aswell as the database server connection credenitials.
 /// </summary>
 /// <param name="database">The database to work with.</param>
 /// <param name="server">The server credenitials for access to database.</param>
 public SqlDatabaseManager(SqlDatabase database, SqlDatabaseServer server)
 {
     this.database         = database;
     this.server           = server;
     this.ConnectionString = GenerateConnectionString(database, server);
 }