diff --git a/Code/Sif3Framework/Sif.Framework/Model/Settings/ConfigFileBasedFrameworkSettings.cs b/Code/Sif3Framework/Sif.Framework/Model/Settings/ConfigFileBasedFrameworkSettings.cs
index 7978fc7a..4d6feb20 100644
--- a/Code/Sif3Framework/Sif.Framework/Model/Settings/ConfigFileBasedFrameworkSettings.cs
+++ b/Code/Sif3Framework/Sif.Framework/Model/Settings/ConfigFileBasedFrameworkSettings.cs
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Systemic Pty Ltd
+ * Copyright 2017 Systemic Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,9 @@
using Sif.Framework.Model.Infrastructure;
using System;
using System.Configuration;
+using System.IO;
+using System.Reflection;
+using System.Web.Hosting;
namespace Sif.Framework.Model.Settings
{
@@ -44,11 +47,11 @@ protected bool GetBooleanSetting(string key, bool defaultValue)
try
{
- value = Boolean.Parse(setting.Value);
+ value = bool.Parse(setting.Value);
}
catch (FormatException)
{
- string message = String.Format("The valid values for the {0} setting are \"true\" or \"false\". The value \"{1}\" is not valid.", setting.Key, setting.Value);
+ string message = $"The valid values for the {setting.Key} setting are \"true\" or \"false\". The value \"{setting.Value}\" is not valid.";
throw new ConfigurationErrorsException(message);
}
@@ -73,11 +76,11 @@ protected int GetIntegerSetting(string key, int defaultValue)
try
{
- value = Int32.Parse(setting.Value);
+ value = int.Parse(setting.Value);
}
catch (FormatException)
{
- string message = String.Format("The value \"{1}\" is not a valid integer for the {0} setting.", setting.Key, setting.Value);
+ string message = $"The value \"{setting.Value}\" is not a valid integer for the {setting.Key} setting.";
throw new ConfigurationErrorsException(message);
}
@@ -120,7 +123,7 @@ protected string GetStringSetting(string key)
///
protected ConfigFileBasedFrameworkSettings()
{
- string configurationFilePath = System.Web.Hosting.HostingEnvironment.MapPath("~/SifFramework.config");
+ string configurationFilePath = HostingEnvironment.MapPath("~/SifFramework.config");
if (configurationFilePath == null)
{
@@ -133,14 +136,21 @@ protected ConfigFileBasedFrameworkSettings()
if (!configuration.HasFile)
{
- string message = String.Format("Missing configuration file {0}.", configurationFilePath);
+ string fullPath = Assembly.GetExecutingAssembly().Location;
+ exeConfigurationFileMap.ExeConfigFilename = Path.GetDirectoryName(fullPath) + "\\SifFramework.config";
+ configuration = ConfigurationManager.OpenMappedExeConfiguration(exeConfigurationFileMap, ConfigurationUserLevel.None);
+ }
+
+ if (!configuration.HasFile)
+ {
+ string message = $"Missing configuration file {configurationFilePath}.";
throw new ConfigurationErrorsException(message);
}
}
///
- ///
+ ///
///
public string ApplicationKey
{
@@ -153,7 +163,7 @@ public string ApplicationKey
}
///
- ///
+ ///
///
public string AuthenticationMethod
{
@@ -166,7 +176,7 @@ public string AuthenticationMethod
}
///
- ///
+ ///
///
public bool CompressPayload
{
@@ -179,7 +189,7 @@ public bool CompressPayload
}
///
- ///
+ ///
///
public string ConsumerName
{
@@ -192,7 +202,7 @@ public string ConsumerName
}
///
- ///
+ ///
///
public string DataModelNamespace
{
@@ -205,7 +215,7 @@ public string DataModelNamespace
}
///
- ///
+ ///
///
public string InfrastructureNamespace
{
@@ -218,7 +228,7 @@ public string InfrastructureNamespace
}
///
- ///
+ ///
///
public bool DeleteOnUnregister
{
@@ -231,7 +241,7 @@ public bool DeleteOnUnregister
}
///
- ///
+ ///
///
public EnvironmentType EnvironmentType
{
@@ -254,7 +264,7 @@ public EnvironmentType EnvironmentType
}
else
{
- string message = String.Format("The valid values for the {0} setting are \"BROKERED\" or \"DIRECT\". The value \"{1}\" is not valid.", setting.Key, setting.Value);
+ string message = $"The valid values for the {setting.Key} setting are \"BROKERED\" or \"DIRECT\". The value \"{setting.Value}\" is not valid.";
throw new ConfigurationErrorsException(message);
}
@@ -266,7 +276,7 @@ public EnvironmentType EnvironmentType
}
///
- ///
+ ///
///
public string EnvironmentUrl
{
@@ -279,7 +289,7 @@ public string EnvironmentUrl
}
///
- ///
+ ///
///
public string InstanceId
{
@@ -292,7 +302,7 @@ public string InstanceId
}
///
- ///
+ ///
///
public int NavigationPageSize
{
@@ -305,7 +315,7 @@ public int NavigationPageSize
}
///
- ///
+ ///
///
public string SharedSecret
{
@@ -318,7 +328,7 @@ public string SharedSecret
}
///
- ///
+ ///
///
public string SolutionId
{
@@ -331,7 +341,7 @@ public string SolutionId
}
///
- ///
+ ///
///
public string SupportedInfrastructureVersion
{
@@ -344,7 +354,7 @@ public string SupportedInfrastructureVersion
}
///
- ///
+ ///
///
public string UserToken
{
@@ -390,5 +400,7 @@ public int JobTimeoutFrequency
{
get { return GetIntegerSetting(SettingsPrefix + ".job.timeout.frequency", 60); }
}
+
}
+
}
diff --git a/Code/Sif3Framework/Sif.Framework/Service/Sessions/ConfigFileBasedSessionService.cs b/Code/Sif3Framework/Sif.Framework/Service/Sessions/ConfigFileBasedSessionService.cs
index 5742f015..d18251d6 100644
--- a/Code/Sif3Framework/Sif.Framework/Service/Sessions/ConfigFileBasedSessionService.cs
+++ b/Code/Sif3Framework/Sif.Framework/Service/Sessions/ConfigFileBasedSessionService.cs
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Systemic Pty Ltd
+ * Copyright 2017 Systemic Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,9 @@
using Sif.Framework.Model.Settings;
using System;
using System.Configuration;
+using System.IO;
+using System.Reflection;
+using System.Web.Hosting;
namespace Sif.Framework.Service.Sessions
{
@@ -43,7 +46,7 @@ abstract class ConfigFileBasedSessionService : ISessionService
///
public ConfigFileBasedSessionService()
{
- string configurationFilePath = System.Web.Hosting.HostingEnvironment.MapPath("~/SifFramework.config");
+ string configurationFilePath = HostingEnvironment.MapPath("~/SifFramework.config");
if (configurationFilePath == null)
{
@@ -56,14 +59,21 @@ public ConfigFileBasedSessionService()
if (!Configuration.HasFile)
{
- string message = String.Format("Missing configuration file {0}.", configurationFilePath);
+ string fullPath = Assembly.GetExecutingAssembly().Location;
+ exeConfigurationFileMap.ExeConfigFilename = Path.GetDirectoryName(fullPath) + "\\SifFramework.config";
+ Configuration = ConfigurationManager.OpenMappedExeConfiguration(exeConfigurationFileMap, ConfigurationUserLevel.None);
+ }
+
+ if (!Configuration.HasFile)
+ {
+ string message = $"Missing configuration file {configurationFilePath}.";
throw new ConfigurationErrorsException(message);
}
}
///
- ///
+ ///
///
public bool HasSession(string applicationKey, string solutionId = null, string userToken = null, string instanceId = null)
{
@@ -71,7 +81,7 @@ public bool HasSession(string applicationKey, string solutionId = null, string u
}
///
- ///
+ ///
///
public bool HasSession(string sessionToken)
{
@@ -79,7 +89,7 @@ public bool HasSession(string sessionToken)
}
///
- ///
+ ///
///
public void RemoveSession(string sessionToken)
{
@@ -94,7 +104,7 @@ public void RemoveSession(string sessionToken)
}
///
- ///
+ ///
///
public string RetrieveEnvironmentUrl(string applicationKey, string solutionId = null, string userToken = null, string instanceId = null)
{
@@ -103,10 +113,10 @@ public string RetrieveEnvironmentUrl(string applicationKey, string solutionId =
foreach (SessionElement session in SessionsSection.Sessions)
{
- if (String.Equals(applicationKey, session.ApplicationKey) &&
- (solutionId == null ? String.IsNullOrWhiteSpace(session.SolutionId) : solutionId.Equals(session.SolutionId)) &&
- (userToken == null ? String.IsNullOrWhiteSpace(session.UserToken) : userToken.Equals(session.UserToken)) &&
- (instanceId == null ? String.IsNullOrWhiteSpace(session.InstanceId) : instanceId.Equals(session.InstanceId)))
+ if (string.Equals(applicationKey, session.ApplicationKey) &&
+ (solutionId == null ? string.IsNullOrWhiteSpace(session.SolutionId) : solutionId.Equals(session.SolutionId)) &&
+ (userToken == null ? string.IsNullOrWhiteSpace(session.UserToken) : userToken.Equals(session.UserToken)) &&
+ (instanceId == null ? string.IsNullOrWhiteSpace(session.InstanceId) : instanceId.Equals(session.InstanceId)))
{
environmentUrl = session.EnvironmentUrl;
break;
@@ -118,7 +128,7 @@ public string RetrieveEnvironmentUrl(string applicationKey, string solutionId =
}
///
- ///
+ ///
///
public string RetrieveSessionToken(string applicationKey, string solutionId = null, string userToken = null, string instanceId = null)
{
@@ -127,10 +137,10 @@ public string RetrieveSessionToken(string applicationKey, string solutionId = nu
foreach (SessionElement session in SessionsSection.Sessions)
{
- if (String.Equals(applicationKey, session.ApplicationKey) &&
- (solutionId == null ? String.IsNullOrWhiteSpace(session.SolutionId) : solutionId.Equals(session.SolutionId)) &&
- (userToken == null ? String.IsNullOrWhiteSpace(session.UserToken) : userToken.Equals(session.UserToken)) &&
- (instanceId == null ? String.IsNullOrWhiteSpace(session.InstanceId) : instanceId.Equals(session.InstanceId)))
+ if (string.Equals(applicationKey, session.ApplicationKey) &&
+ (solutionId == null ? string.IsNullOrWhiteSpace(session.SolutionId) : solutionId.Equals(session.SolutionId)) &&
+ (userToken == null ? string.IsNullOrWhiteSpace(session.UserToken) : userToken.Equals(session.UserToken)) &&
+ (instanceId == null ? string.IsNullOrWhiteSpace(session.InstanceId) : instanceId.Equals(session.InstanceId)))
{
sessionToken = session.SessionToken;
break;
@@ -142,14 +152,14 @@ public string RetrieveSessionToken(string applicationKey, string solutionId = nu
}
///
- ///
+ ///
///
public void StoreSession(string applicationKey, string sessionToken, string environmentUrl, string solutionId = null, string userToken = null, string instanceId = null)
{
if (HasSession(applicationKey, solutionId, userToken, instanceId))
{
- string message = String.Format("Session with the following credentials already exists - [applicationKey={0}]{1}{2}{3}.",
+ string message = string.Format("Session with the following credentials already exists - [applicationKey={0}]{1}{2}{3}.",
applicationKey,
(solutionId == null ? "" : "[solutionId=" + solutionId + "]"),
(userToken == null ? "" : "[userToken=" + userToken + "]"),
@@ -159,7 +169,7 @@ public void StoreSession(string applicationKey, string sessionToken, string envi
if (HasSession(sessionToken))
{
- string message = String.Format("Session already exists with a session token of {0}.", sessionToken);
+ string message = string.Format("Session already exists with a session token of {0}.", sessionToken);
throw new ConfigurationErrorsException(message);
}
diff --git a/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll b/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll
index 8882bd30..a70067eb 100644
Binary files a/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll and b/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll differ