protected override string GetDbProviderManifestToken(DbConnection connection) { // we need the connection option to determine what version of the server // we are connected to MySqlConnectionStringBuilder msb = new MySqlConnectionStringBuilder((connection as MySqlConnection).GetSettings().ConnectionString); msb.Database = null; using (MySqlConnection c = new MySqlConnection(msb.ConnectionString)) { c.Open(); var v = DBVersionCustom.Parse(c.ServerVersion); serverVersion = new Version(v.Major + "." + v.Minor); double version = double.Parse(c.ServerVersion.Substring(0, 3), CultureInfo.InvariantCulture); if (version < 5.0) { throw new NotSupportedException("Versions of MySQL prior to 5.0 are not currently supported"); } if (version < 5.1) { return("5.0"); } if (version < 5.5) { return("5.1"); } if (version < 5.6) { return("5.5"); } if (version < 5.7) { return("5.6"); } if (version < 8.0) { return("5.7"); } return("8.0"); } }
public string GetTableCreateScript(EntitySet entitySet, string connectionString, string version) { MySqlProviderServices service = new MySqlProviderServices(); if (!String.IsNullOrEmpty(version)) { service.serverVersion = new Version(version); } else { using (var conn = new MySqlConnection(connectionString.Replace(@"""", ""))) { conn.Open(); var v = DBVersionCustom.Parse(conn.ServerVersion.ToString()); service.serverVersion = new Version(v.Major + "." + v.Minor); } } if (service.serverVersion == null) { service.serverVersion = new Version("5.5"); } return(service.GetTableCreateScript(entitySet)); }