using System; using System.Collections.Generic; using System.Text; using ICSharpCode.Data.Core.DatabaseObjects; using ICSharpCode.Data.Core.Interfaces; using MySql.Data.MySqlClient; namespace ICSharpCode.Data.Core.DatabaseDrivers.MySQL { public class MySQLDatasource : Datasource { #region Fields //private MySQLrControlPanel _controlPanel = null; #endregion #region Properties public string Server { get { //get的值!=set的值 return GetConnectionStringSetting( "Data Source" ); } set { SetConnectionStringSetting( "Data Source" , value.Replace(":",";Port=") ); OnPropertyChanged( "Data Source" ); } } public string UserId { get { return GetConnectionStringSetting( "User Id" ); } set { SetConnectionStringSetting( "User Id" , value ); OnPropertyChanged( "UserId" ); } } public string Password { get { return GetConnectionStringSetting( "Password" ); } set { SetConnectionStringSetting( "Password" , value ); OnPropertyChanged( "Password" ); } } //public bool IntegratedSecurity //{ //} public string InitialCatalog { get { return GetConnectionStringSetting( "Initial Catalog" , "INFORMATION_SCHEMA" ); } set { SetConnectionStringSetting( "Initial Catalog" , value ); OnPropertyChanged( "Initial Catalog" ); } } #endregion #region Constructor public MySQLDatasource(IDatabaseDriver databaseDriver) : base(databaseDriver) { } #endregion #region Methods protected override bool HandlePopulateDatabasesException( Exception exception ) { if ( exception is NotSupportedException ) { DatabaseDriver.RemoveDatasource( Name ); ICSharpCode.Core.LoggingService.Error("尝试填充数据库失败。\n\n" + exception.Message); //MessageBox.Show( "Error while trying to populate databases.\n\n" + exception.Message , DatabaseDriver.Name , MessageBoxButtons.OK , MessageBoxIcon.Exclamation ); return false; } else { throw exception; } } #endregion } }