Pull up Assembly of the MySQL classes as a protected property, so that it can be overwritten in subclasses. That way extensions can decide in which assembly migration resources should be looked up. This is just a refactor -- no functional changes whatsoever.

0.7.1-dev
Diva Canto 2011-03-08 09:02:29 -08:00
parent 9b345ebf73
commit 9923a2ff10
6 changed files with 39 additions and 11 deletions

View File

@ -47,6 +47,11 @@ namespace OpenSim.Data.MySQL
private string m_connectionString;
private object m_dbLock = new object();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
#region IPlugin Members
public override string Version { get { return "1.0.0.0"; } }
@ -66,13 +71,10 @@ namespace OpenSim.Data.MySQL
{
m_connectionString = connect;
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, assem, "AssetStore");
Migration m = new Migration(dbcon, Assembly, "AssetStore");
m.Update();
}
}

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
@ -42,6 +43,11 @@ namespace OpenSim.Data.MySQL
private int m_LastExpire;
// private string m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySqlAuthenticationData(string connectionString, string realm)
: base(connectionString)
{
@ -51,7 +57,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
Migration m = new Migration(dbcon, Assembly, "AuthStore");
m.Update();
}
}

View File

@ -54,6 +54,11 @@ namespace OpenSim.Data.MySQL
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySQLEstateStore()
{
}
@ -82,8 +87,7 @@ namespace OpenSim.Data.MySQL
{
dbcon.Open();
Assembly assem = GetType().Assembly;
Migration m = new Migration(dbcon, assem, "EstateStore");
Migration m = new Migration(dbcon, Assembly, "EstateStore");
m.Update();
Type t = typeof(EstateSettings);

View File

@ -46,6 +46,11 @@ namespace OpenSim.Data.MySQL
protected string m_Realm;
protected FieldInfo m_DataField = null;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySQLGenericTableHandler(string connectionString,
string realm, string storeName) : base(connectionString)
{
@ -57,7 +62,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, storeName);
Migration m = new Migration(dbcon, Assembly, storeName);
m.Update();
}
}

View File

@ -29,6 +29,8 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
@ -42,6 +44,11 @@ namespace OpenSim.Data.MySQL
private List<string> m_ColumnNames;
//private string m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySqlRegionData(string connectionString, string realm)
: base(connectionString)
{
@ -51,7 +58,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, "GridStore");
Migration m = new Migration(dbcon, Assembly, "GridStore");
m.Update();
}
}

View File

@ -52,6 +52,11 @@ namespace OpenSim.Data.MySQL
private string m_connectionString;
private object m_dbLock = new object();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySQLSimulationData()
{
}
@ -71,8 +76,7 @@ namespace OpenSim.Data.MySQL
// Apply new Migrations
//
Assembly assem = GetType().Assembly;
Migration m = new Migration(dbcon, assem, "RegionStore");
Migration m = new Migration(dbcon, Assembly, "RegionStore");
m.Update();
// Clean dropped attachments