diff --git a/Results/DBase.cs b/Results/DBase.cs
new file mode 100644
index 000000000..db9ffb07c
--- /dev/null
+++ b/Results/DBase.cs
@@ -0,0 +1,63 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System;
+using System.Collections.Generic;
+using FluentNHibernate.Cfg;
+using FluentNHibernate.Cfg.Db;
+using log4net;
+using NHibernate;
+using NHibernate.Cfg;
+using NHibernate.Tool.hbm2ddl;
+using Results.Entities;
+
+namespace Results
+{
+ public class DBase
+ {
+ static readonly ILog log = LogManager.GetLogger(typeof(DBase));
+
+ /// Session factory for all regular sessions, not for CreateEmptyResultsDB().
+ public static IList Databases;
+ public static int Count { get { return Databases.Count; } }
+
+ static DBase()
+ {
+ Databases = new List();
+ }
+
+
+ public readonly string Name;
+ public readonly string ConnectionString;
+
+ ISessionFactory sessionFactory;
+
+ public DBase(string connectionString, string name)
+ {
+ this.ConnectionString = connectionString;
+ this.Name = name;
+ sessionFactory = Fluently.Configure()
+ .Database(MySQLConfiguration.Standard.ConnectionString(connectionString))
+ .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
+ .ExposeConfiguration(BuildSchema)
+ .BuildSessionFactory();
+ }
+
+ public DBase(string connectionString)
+ : this(connectionString, string.Empty)
+ {
+ }
+
+
+ private void BuildSchema(Configuration config)
+ {
+ /// This NHibernate tool takes a configuration with mapping info and exports a database schema
+ new SchemaExport(config).SetOutputFile("db_schema");
+ }
+
+ public ISession OpenSession()
+ {
+ return sessionFactory.OpenSession();
+ }
+ }
+}
diff --git a/Results/Results.csproj b/Results/Results.csproj
index 998c44763..ee535a315 100644
--- a/Results/Results.csproj
+++ b/Results/Results.csproj
@@ -59,6 +59,7 @@
+
diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
index 06d936357..75969fece 100644
--- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
+++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
@@ -377,7 +377,19 @@ namespace TBF.BenchControl.Sequences
if (selection == Selection.Custom)
{
/// Load existing data from databases
- int a = 5;
+ Results.DBase.Databases.Clear();
+ try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.197; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR10")); }
+ catch (Exception exc) { log.ErrorFormat("Cannot open WR10 result database: {0}", exc.Message); }
+ try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.98; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR11")); }
+ catch (Exception exc) { log.ErrorFormat("Cannot open WR11 result database: {0}", exc.Message); }
+ try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.152; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR13")); }
+ catch (Exception exc) { log.ErrorFormat("Cannot open WR13 result database: {0}", exc.Message); }
+ try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.63; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR15")); }
+ catch (Exception exc) { log.ErrorFormat("Cannot open WR15 result database: {0}", exc.Message); }
+
+ foreach (var wm in BatchRslts.WaterMeters)
+ {
+ }
}
}