//--- Constructors --- public MysqlDataUpdater(string server, int port, string dbname, string dbuser, string dbpassword, string version) { _effectiveVersion = new VersionInfo(version); if(!_effectiveVersion.IsValid) { throw new VersionInfoException(_effectiveVersion); } // initialize the data catalog var dataFactory = new DataFactory("MySql.Data", "?"); var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword); _dataCatalog = new DataCatalog(dataFactory, connectionString); _dataCatalog.TestConnection(); }
//--- Constructors --- public MysqlDataUpdater(string server, int port, string dbname, string dbuser, string dbpassword, string version, uint timeout) { if(string.IsNullOrEmpty(version)) { _targetVersion = null; } else { _targetVersion = new VersionInfo(version); if(!_targetVersion.IsValid) { throw new VersionInfoException(_targetVersion); } } // initialize the data catalog var dataFactory = new DataFactory("MySql.Data", "?"); var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword, timeout); _dataCatalog = new DataCatalog(dataFactory, connectionString); _dataCatalog.TestConnection(); }
//--- Methods --- public VersionDiff CompareTo(VersionInfo other) { if(!IsValid || !other.IsValid) { return Raw.CompareTo(other.Raw) == 0 ? new VersionDiff(VersionChange.None, VersionSeverity.None) : new VersionDiff(VersionChange.Incompatible, VersionSeverity.Unknown); } var change = VersionChange.None; var severity = VersionSeverity.None; if(Major > other.Major) { change = VersionChange.Upgrade; severity = VersionSeverity.Major; } else if(Major < other.Major) { change = VersionChange.Downgrade; severity = VersionSeverity.Major; } else if(Minor > other.Minor) { change = VersionChange.Upgrade; severity = VersionSeverity.Minor; } else if(Minor < other.Minor) { change = VersionChange.Downgrade; severity = VersionSeverity.Minor; } else if(Revision > other.Revision) { change = VersionChange.Upgrade; severity = VersionSeverity.Revision; } else if(Revision < other.Revision) { change = VersionChange.Downgrade; severity = VersionSeverity.Revision; } return new VersionDiff(change, severity); }
public DbMethod(MethodInfo methodInfo, VersionInfo targetVersion, MethodType methodType) { _methodInfo = methodInfo; _targetVersion = targetVersion; _methodType = methodType; }
//--- Constructors --- public DbMethod(MethodInfo methodInfo, VersionInfo targetVersion) { _methodInfo = methodInfo; _targetVersion = targetVersion; _methodType = MethodType.Update; }
public VersionInfoException(VersionInfo _versionInfo) : base(String.Format("Version string is invalid : {0}", _versionInfo.ToString())) { }