Test.Publish and Test.Evaluate added, other Results DB related changes.
This commit is contained in:
+28
-2
@@ -2,8 +2,10 @@
|
||||
/// Copyright (c) 2013-2015 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;
|
||||
@@ -12,6 +14,8 @@ namespace Results
|
||||
{
|
||||
public static class DB
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(DB));
|
||||
|
||||
/// <summary> Session factory for all regular sessions, not for CreateEmptyResultsDB(). </summary>
|
||||
public static ISessionFactory SessionFactory;
|
||||
|
||||
@@ -62,7 +66,7 @@ namespace Results
|
||||
break;
|
||||
}
|
||||
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<DataDeposit>());
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>());
|
||||
|
||||
if (createDB)
|
||||
{
|
||||
@@ -154,5 +158,27 @@ namespace Results
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Shared data
|
||||
/// </summary>
|
||||
public static IList<Entities.TestData> TestDataList;
|
||||
public static IList<Entities.Components> ComponentsList;
|
||||
public static IList<Entities.WaterMeterData> WaterMeterDataList;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loads shared data from the database
|
||||
/// </summary>
|
||||
/// <exception>Throws NHibernate exceptions</exception>
|
||||
public static void LoadSharedData()
|
||||
{
|
||||
ISession session = DB.CreateSession();
|
||||
|
||||
TestDataList = session.CreateQuery("FROM TestData").List<Entities.TestData>();
|
||||
ComponentsList = session.CreateQuery("FROM Components").List<Entities.Components>();
|
||||
WaterMeterDataList = session.CreateQuery("FROM WaterMeterData").List<Entities.WaterMeterData>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user