public static Version GetSchemaVersion(Guid applicationId) { var major = 0; var minor = 0; var build = 0; var revision = 0; try { using (IDataReader reader = DBPortal.SchemaVersionGetSchemaVersion(applicationId)) { if (reader.Read()) { major = Convert.ToInt32(reader["Major"]); minor = Convert.ToInt32(reader["Minor"]); build = Convert.ToInt32(reader["Build"]); revision = Convert.ToInt32(reader["Revision"]); } } } catch (DbException) { } catch (InvalidOperationException) { } catch (Exception ex) { // hate to trap System.Exception but SqlCeException doe snot inherit from DbException as it should if (DBPlatform() != "SqlCe") { throw; } log.Error(ex); } return(new Version(major, minor, build, revision)); }
public static Version GetSchemaVersion(Guid applicationId) { //Guid CappID = new Guid("077e4857-f583-488e-836e-34a4b04be855"); //if (applicationID == CappID) //{ // return dbSchemaVersion(); //} int major = 0; int minor = 0; int build = 0; int revision = 0; try { using (IDataReader reader = DBPortal.SchemaVersionGetSchemaVersion(applicationId)) { if (reader.Read()) { major = Convert.ToInt32(reader["Major"]); minor = Convert.ToInt32(reader["Minor"]); build = Convert.ToInt32(reader["Build"]); revision = Convert.ToInt32(reader["Revision"]); } } } catch (DbException) { } catch (InvalidOperationException) { } return(new Version(major, minor, build, revision)); }
public static String GetApplicationName(Guid applicationId) { String appName = null; using (IDataReader reader = DBPortal.SchemaVersionGetSchemaVersion(applicationId)) { if (reader.Read()) { appName = reader["ApplicationName"].ToString(); } } return(appName); }
public static Version DBSchemaVersion() { // this should never change // its the last version before auto upgrades int major = 2; int minor = 2; int build = 1; int revision = 4; bool found = false; try { using (IDataReader reader = DBPortal.SchemaVersionGetSchemaVersion(GetApplicationId())) { if (reader.Read()) { major = Convert.ToInt32(reader["Major"]); minor = Convert.ToInt32(reader["Minor"]); build = Convert.ToInt32(reader["Build"]); revision = Convert.ToInt32(reader["Revision"]); found = true; } } if (!found) { DBPortal.SchemaVersionAddSchemaVersion( GetApplicationId(), GetApplicationName(), major, minor, build, revision); } } catch (DbException) { } catch (InvalidOperationException) { } return(new Version(major, minor, build, revision)); }
public static Version GetSchemaVersion(Guid applicationId) { //Guid mojoappID = new Guid("077e4857-f583-488e-836e-34a4b04be855"); //if (applicationID == mojoappID) //{ // return dbSchemaVersion(); //} int major = 0; int minor = 0; int build = 0; int revision = 0; try { using (IDataReader reader = DBPortal.SchemaVersionGetSchemaVersion(applicationId)) { if (reader.Read()) { major = Convert.ToInt32(reader["Major"]); minor = Convert.ToInt32(reader["Minor"]); build = Convert.ToInt32(reader["Build"]); revision = Convert.ToInt32(reader["Revision"]); } } } catch (DbException) { } catch (InvalidOperationException) { } catch (Exception ex) { // hate to trap System.Exception but SqlCeException doe snot inherit from DbException as it should if (DatabaseHelper.DBPlatform() != "SqlCe") { throw; } log.Error(ex); } return(new Version(major, minor, build, revision)); }