Added Command Line support to set the server so that we don't need to duplicate the executable folder to create versions that use the local database or SQL2008.
This commit is contained in:
parent
f5a9e032a2
commit
b84141f9e5
@ -93,11 +93,13 @@ namespace VEPROMS.CSLA.Library
|
||||
if (xn != null)
|
||||
{
|
||||
//if (xn.InnerText.Contains("{MENU}") && SelectedDatabase != null && SelectedDatabase.Length > 0)
|
||||
if (xn.InnerText.Contains("{MENU}"))
|
||||
_VEPROMS_Connection = ChooseDatabase(xn.InnerText);
|
||||
else
|
||||
_VEPROMS_Connection = xn.InnerText;
|
||||
return _VEPROMS_Connection;
|
||||
string constr1 = FixServer(xn.InnerText);
|
||||
if (constr1.Contains("{MENU}"))
|
||||
{
|
||||
constr1 = ChooseDatabase(constr1);
|
||||
}
|
||||
return _VEPROMS_Connection = constr1;
|
||||
|
||||
}
|
||||
}
|
||||
// Otherwise get the value from the ConfigurationManager
|
||||
@ -106,7 +108,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
throw new ApplicationException("Database.cs Could not find connection " + ConnectionName);
|
||||
}
|
||||
string constr = cs.ConnectionString;
|
||||
string constr = FixServer(cs.ConnectionString);
|
||||
if (constr.Contains("{MENU}"))
|
||||
{
|
||||
constr = ChooseDatabase(constr);
|
||||
@ -115,6 +117,19 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
set { _VEPROMS_Connection = value; }
|
||||
}
|
||||
private static string FixServer(string connectionString)
|
||||
{
|
||||
string serverName = Volian.Base.Library.VlnSettings.GetCommand("Server",null);
|
||||
if (serverName != null && serverName != "")
|
||||
{
|
||||
System.Text.RegularExpressions.Match mServer = System.Text.RegularExpressions.Regex.Match(connectionString, ".*Data Source=([^;]*).*");
|
||||
if (mServer.Success)
|
||||
{
|
||||
connectionString = connectionString.Substring(0, mServer.Groups[1].Index) + serverName + connectionString.Substring(mServer.Groups[1].Index + mServer.Groups[1].Length);
|
||||
}
|
||||
}
|
||||
return connectionString;
|
||||
}
|
||||
private static string _SelectedDatabase;
|
||||
public static string SelectedDatabase
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user