#region Usings using ICSharpCode.Data.Core.DatabaseObjects; using ICSharpCode.Data.Core.Interfaces; using System.Threading; using System; using Oracle.DataAccess.Client; #endregion namespace ICSharpCode.Data.Oracle { public class OracleDatasource : Datasource { #region Fields #endregion #region Properties public string Server { get { return GetConnectionStringSetting("Data Source"); } set { SetConnectionStringSetting( "Data Source" , value.Replace(":",",") ); 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"); } } #endregion #region Constructor public OracleDatasource(IDatabaseDriver databaseDriver) : base(databaseDriver) { } #endregion #region Methods protected override bool HandlePopulateDatabasesException(Exception exception) { if (exception is OracleException) { OracleException sqlException = exception as OracleException; if (sqlException.Number == 67) { 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; } } else 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 } }