aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate/NHibernateUserData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/NHibernate/NHibernateUserData.cs')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs18
1 files changed, 12 insertions, 6 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index 2e55e03..6a830f6 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.IO; 30using System.IO;
30using System.Reflection; 31using System.Reflection;
@@ -35,6 +36,7 @@ using NHibernate.Cfg;
35using NHibernate.Expression; 36using NHibernate.Expression;
36using NHibernate.Mapping.Attributes; 37using NHibernate.Mapping.Attributes;
37using OpenSim.Framework; 38using OpenSim.Framework;
39using Environment=NHibernate.Cfg.Environment;
38 40
39namespace OpenSim.Data.NHibernate 41namespace OpenSim.Data.NHibernate
40{ 42{
@@ -48,20 +50,24 @@ namespace OpenSim.Data.NHibernate
48 private Configuration cfg; 50 private Configuration cfg;
49 private ISessionFactory factory; 51 private ISessionFactory factory;
50 52
51 public override void Initialise() 53 public override void Initialise(string connect)
52 { 54 {
53 // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test 55 char[] split = {';'};
56 string[] parts = connect.Split(split, 3);
57 if (parts.Length != 3) {
58 // TODO: make this a real exception type
59 throw new Exception("Malformed Inventory connection string '" + connect + "'");
60 }
54 61
55 // This is stubbing for now, it will become dynamic later and support different db backends 62 // This is stubbing for now, it will become dynamic later and support different db backends
56 cfg = new Configuration(); 63 cfg = new Configuration();
57 cfg.SetProperty(Environment.ConnectionProvider, 64 cfg.SetProperty(Environment.ConnectionProvider,
58 "NHibernate.Connection.DriverConnectionProvider"); 65 "NHibernate.Connection.DriverConnectionProvider");
59 cfg.SetProperty(Environment.Dialect, 66 cfg.SetProperty(Environment.Dialect,
60 "NHibernate.Dialect.SQLiteDialect"); 67 "NHibernate.Dialect." + parts[0]);
61 cfg.SetProperty(Environment.ConnectionDriver, 68 cfg.SetProperty(Environment.ConnectionDriver,
62 "NHibernate.Driver.SqliteClientDriver"); 69 "NHibernate.Driver." + parts[1]);
63 cfg.SetProperty(Environment.ConnectionString, 70 cfg.SetProperty(Environment.ConnectionString, parts[2]);
64 "URI=file:User.db,version=3");
65 cfg.AddAssembly("OpenSim.Data.NHibernate"); 71 cfg.AddAssembly("OpenSim.Data.NHibernate");
66 72
67 HbmSerializer.Default.Validate = true; 73 HbmSerializer.Default.Validate = true;