This commit is contained in:
Morten Christensen
2013-01-29 12:59:14 -01:00
5 changed files with 23 additions and 19 deletions

View File

@@ -170,7 +170,7 @@ namespace Umbraco.Core.Configuration
{
if (value.ToLower().Contains("SQLCE4Umbraco.SqlCEHelper".ToLower()))
{
ApplicationContext.Current.DatabaseContext.ConfigureDatabaseConnection();
ApplicationContext.Current.DatabaseContext.ConfigureEmbeddedDatabaseConnection();
}
else
{

View File

@@ -22,15 +22,15 @@ namespace Umbraco.Core
/// </remarks>
public class DatabaseContext
{
private readonly IDatabaseFactory _factory;
private bool _configured;
private readonly IDatabaseFactory _factory;
private bool _configured;
private string _connectionString;
private string _providerName;
private DatabaseSchemaResult _result;
internal DatabaseContext(IDatabaseFactory factory)
{
_factory = factory;
_factory = factory;
}
/// <summary>
@@ -109,7 +109,7 @@ namespace Umbraco.Core
/// <summary>
/// Configure a ConnectionString for the embedded database.
/// </summary>
public void ConfigureDatabaseConnection()
public void ConfigureEmbeddedDatabaseConnection()
{
const string providerName = "System.Data.SqlServerCe.4.0";
const string connectionString = "Datasource=|DataDirectory|Umbraco.sdf";
@@ -151,12 +151,12 @@ namespace Umbraco.Core
{
string connectionString;
string providerName = "System.Data.SqlClient";
if(databaseProvider.ToLower().Contains("mysql"))
if (databaseProvider.ToLower().Contains("mysql"))
{
providerName = "MySql.Data.MySqlClient";
connectionString = string.Format("Server={0}; Database={1};Uid={2};Pwd={3}", server, databaseName, user, password);
}
else if(databaseProvider.ToLower().Contains("azure"))
else if (databaseProvider.ToLower().Contains("azure"))
{
connectionString = string.Format("Server=tcp:{0}.database.windows.net;Database={1};User ID={2}@{0};Password={3}", server, databaseName, user, password);
}
@@ -252,7 +252,7 @@ namespace Umbraco.Core
var legacyConnString = ConfigurationManager.AppSettings[GlobalSettings.UmbracoConnectionName];
if (legacyConnString.ToLowerInvariant().Contains("sqlce4umbraco"))
{
ConfigureDatabaseConnection();
ConfigureEmbeddedDatabaseConnection();
}
else if (legacyConnString.ToLowerInvariant().Contains("database.windows.net") &&
legacyConnString.ToLowerInvariant().Contains("tcp:"))
@@ -261,12 +261,16 @@ namespace Umbraco.Core
SaveConnectionString(legacyConnString, "System.Data.SqlClient");
Initialize("System.Data.SqlClient");
}
else if (legacyConnString.ToLowerInvariant().Contains("Uid") &&
legacyConnString.ToLowerInvariant().Contains("Pwd") &&
legacyConnString.ToLowerInvariant().Contains("Server"))
else if (legacyConnString.ToLowerInvariant().Contains("datalayer=mysql"))
{
//Must be MySql
SaveConnectionString(legacyConnString, "MySql.Data.MySqlClient");
//Need to strip the datalayer part off
var connectionStringWithoutDatalayer = string.Empty;
foreach (var variable in legacyConnString.Split(';').Where(x => x.ToLowerInvariant().StartsWith("datalayer") == false))
connectionStringWithoutDatalayer = string.Format("{0}{1};", connectionStringWithoutDatalayer, variable);
SaveConnectionString(connectionStringWithoutDatalayer, "MySql.Data.MySqlClient");
Initialize("MySql.Data.MySqlClient");
}
else

View File

@@ -72,7 +72,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
list =
items.Select(
item =>
new ColumnInfo(item.TABLE_NAME, item.COLUMN_NAME, item.ORDINAL_POSITION, item.COLUMN_DEFAULT,
new ColumnInfo(item.TABLE_NAME, item.COLUMN_NAME, int.Parse(item.ORDINAL_POSITION.ToString()), item.COLUMN_DEFAULT ?? "",
item.IS_NULLABLE, item.DATA_TYPE)).ToList();
}
finally

View File

@@ -183,7 +183,7 @@ namespace umbraco.presentation.install.steps
}
else if (IsEmbeddedDatabase)
{
ApplicationContext.Current.DatabaseContext.ConfigureDatabaseConnection();
ApplicationContext.Current.DatabaseContext.ConfigureEmbeddedDatabaseConnection();
}
else
{

View File

@@ -51,7 +51,7 @@ namespace umbraco.cms.presentation.members
saveExtras();
ClientTools
.ShowSpeechBubble(speechBubbleIcon.save, "Memebertype saved", "")
.ShowSpeechBubble(speechBubbleIcon.save, "Membertype saved", "")
.SyncTree(dt.Id.ToString(), true);
}