From 9923a2ff1002d722ccebea8bf4d71718ed4e2a03 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 8 Mar 2011 09:02:29 -0800 Subject: 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. --- OpenSim/Data/MySQL/MySQLAssetData.cs | 10 ++++++---- OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 8 +++++++- OpenSim/Data/MySQL/MySQLEstateData.cs | 8 ++++++-- OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 7 ++++++- OpenSim/Data/MySQL/MySQLRegionData.cs | 9 ++++++++- OpenSim/Data/MySQL/MySQLSimulationData.cs | 8 ++++++-- 6 files changed, 39 insertions(+), 11 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index ed92f3e..e740232 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -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(); } } diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 5056aee..8d82f61 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs @@ -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(); } } diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index c42c687..de72a6a 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -54,6 +54,11 @@ namespace OpenSim.Data.MySQL private Dictionary m_FieldMap = new Dictionary(); + 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); diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 7c23a47..8efe4e9 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs @@ -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(); } } diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index d04e3dc..c20c392 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -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 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(); } } diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 02997b3..e14d775 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -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 -- cgit v1.1