internal static string ConvertNormalCS2EFFromConfig(string configSettings, DatabasePlatformConstants platform) { if (string.IsNullOrEmpty(configSettings)) { return(configSettings); } var arr = configSettings.Split('='); if (arr.Length != 2) { return(configSettings); } if (arr[0] != "name") { return(configSettings); } try { var cs = System.Configuration.ConfigurationManager.ConnectionStrings[arr[1]].ConnectionString; if (!cs.StartsWith("metadata=")) { return(ConvertNormalCS2EF(cs, platform)); } return(configSettings); } catch { return(configSettings); } }
internal static string ConvertNormalCS2EFFromConfig(string configSettings, DatabasePlatformConstants platform) { if (string.IsNullOrEmpty(configSettings)) return configSettings; var arr = configSettings.Split('='); if (arr.Length != 2) return configSettings; if (arr[0] != "name") return configSettings; try { var cs = System.Configuration.ConfigurationManager.ConnectionStrings[arr[1]].ConnectionString; if (!cs.StartsWith("metadata=")) return ConvertNormalCS2EF(cs, platform); return configSettings; } catch { return configSettings; } }
internal static string ConvertNormalCS2EF(string connectionString, DatabasePlatformConstants platform) { if (string.IsNullOrEmpty(connectionString)) { return(connectionString); } if (connectionString.StartsWith("metadata=")) { return(connectionString); } if (platform == DatabasePlatformConstants.MySql) { return(@"metadata=res://*/Acme.Northwind.EFDAL.Northwind.MySql.csdl|res://*/Acme.Northwind.EFDAL.Northwind.MySql.ssdl|res://*/Acme.Northwind.EFDAL.Northwind.msl;provider=MySql.Data.MySqlClient;provider connection string='" + connectionString + "'"); } else if (platform == DatabasePlatformConstants.SQLServer) { return(@"metadata=res://*/Acme.Northwind.EFDAL.Northwind.csdl|res://*/Acme.Northwind.EFDAL.Northwind.ssdl|res://*/Acme.Northwind.EFDAL.Northwind.msl;provider=System.Data.SqlClient;provider connection string='" + connectionString + "'"); } else { throw new Exception("Unknown platform!"); } }
/// <summary> /// Creates a new instance of the ContextStartup object /// </summary> public ContextStartup(string modifier, bool allowLazyLoading, int commandTimeout, DatabasePlatformConstants currentPlatform) : this(modifier, allowLazyLoading) { this.CurrentPlatform = currentPlatform; this.CommandTimeout = commandTimeout; }
/// <summary> /// Creates a new instance of the ContextStartup object /// </summary> public ContextStartup(string modifier, DatabasePlatformConstants currentPlatform) : this(modifier) { this.CurrentPlatform = currentPlatform; }
internal static string ConvertNormalCS2EF(string connectionString, DatabasePlatformConstants platform) { if (string.IsNullOrEmpty(connectionString)) return connectionString; if (connectionString.StartsWith("metadata=")) return connectionString; if (platform == DatabasePlatformConstants.MySql) return @"metadata=res://*/Acme.Northwind.EFDAL.Northwind.MySql.csdl|res://*/Acme.Northwind.EFDAL.Northwind.MySql.ssdl|res://*/Acme.Northwind.EFDAL.Northwind.msl;provider=MySql.Data.MySqlClient;provider connection string='" + connectionString + "'"; else if (platform == DatabasePlatformConstants.SQLServer) return @"metadata=res://*/Acme.Northwind.EFDAL.Northwind.csdl|res://*/Acme.Northwind.EFDAL.Northwind.ssdl|res://*/Acme.Northwind.EFDAL.Northwind.msl;provider=System.Data.SqlClient;provider connection string='" + connectionString + "'"; else throw new Exception("Unknown platform!"); }
protected override void OnValueChanging(nHydrateModelBase element, DatabasePlatformConstants oldValue, DatabasePlatformConstants newValue) { var model = element as nHydrateModel; if (!model.IsLoading) { throw new Exception("Only SQL Server is currently supported. This value cannot be changed."); } base.OnValueChanging(element, oldValue, newValue); }
/// <summary> /// Creates a new instance of the ContextStartup object /// </summary> public ContextStartup(string modifier, bool allowLazyLoading, int commandTimeout, DatabasePlatformConstants currentPlatform) : this(modifier, allowLazyLoading) { this.CurrentPlatform = currentPlatform; this.CommandTimeout = commandTimeout; }
/// <summary> /// Creates a new instance of the ContextStartup object /// </summary> public ContextStartup(string modifier, DatabasePlatformConstants currentPlatform) : this(modifier) { this.CurrentPlatform = currentPlatform; }