IsRemoteDBCompatible( ) copes with no remote DB connection, ver. 2.18.1024

This commit is contained in:
Milan Hanajik 2018-10-13 06:44:00 +02:00
parent 8fc9e3e5ce
commit 5e3d408706
2 changed files with 23 additions and 9 deletions

View File

@ -384,6 +384,27 @@ namespace TBF.BenchControl
/// <returns>true when DB-s are compatible</returns>
public static bool IsRemoteDBCompatible(out string message)
{
IList<Config.Entities.FeedingPath> remoteFeedingPaths;
IList<Config.Entities.BenchPath> remoteBenchPaths;
IList<Config.Entities.OutputPath> remoteOutputPaths;
IList<Config.Entities.MetersPath> remoteMetersPaths;
IList<Config.Entities.TransitionSequence> remoteTransitions;
try
{
ISession remoteSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.RemoteConfig);
remoteFeedingPaths = remoteSession.QueryOver<Config.Entities.FeedingPath>().List();
remoteBenchPaths = remoteSession.QueryOver<Config.Entities.BenchPath>().List();
remoteOutputPaths = remoteSession.QueryOver<Config.Entities.OutputPath>().List();
remoteMetersPaths = remoteSession.QueryOver<Config.Entities.MetersPath>().List();
remoteTransitions = remoteSession.QueryOver<Config.Entities.TransitionSequence>().List();
}
catch (Exception)
{
message = "Cannot open remote database";
return false;
}
ISession localSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
var localFeedingPaths = localSession.QueryOver<Config.Entities.FeedingPath>().List();
var localBenchPaths = localSession.QueryOver<Config.Entities.BenchPath>().List();
@ -391,13 +412,6 @@ namespace TBF.BenchControl
var localMetersPaths = localSession.QueryOver<Config.Entities.MetersPath>().List();
var localTransitions = localSession.QueryOver<Config.Entities.TransitionSequence>().List();
ISession remoteSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.RemoteConfig);
var remoteFeedingPaths = remoteSession.QueryOver<Config.Entities.FeedingPath>().List();
var remoteBenchPaths = remoteSession.QueryOver<Config.Entities.BenchPath>().List();
var remoteOutputPaths = remoteSession.QueryOver<Config.Entities.OutputPath>().List();
var remoteMetersPaths = remoteSession.QueryOver<Config.Entities.MetersPath>().List();
var remoteTransitions = remoteSession.QueryOver<Config.Entities.TransitionSequence>().List();
string subMsg;
if (!IsCompatible(localFeedingPaths, remoteFeedingPaths, out subMsg))
{

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1023.0")]
[assembly: AssemblyFileVersion("2.18.1023.0")]
[assembly: AssemblyVersion("2.18.1024.0")]
[assembly: AssemblyFileVersion("2.18.1024.0")]