In the moment of deploy, if I put the file in the same folder as the exe, so far so good. However, if is executed in from a diferent path (or when try to run the exe from other exe, like for testing with TestDriven.NET) get the error
To solve the problem please use .daConfig as an embedded resource as before but change Engine.cs file as follows:
from:
if (!RemObjects.DataAbstract.Server.Configuration.Loaded)
RemObjects.DataAbstract.Server.Configuration.Load();
to:
if (!RemObjects.DataAbstract.Server.Configuration.Loaded)
RemObjects.DataAbstract.Server.Configuration.LoadFromResource();
or:
RemObjects.DataAbstract.Server.Configuration.LoadFromResource();
It will allow to load drivers configuration directly from embedded .daConfig file.
Yes, it work. Also fail when run with Gallio.echo command-line test runner (so, I suspect if the exe call the server in a path different to the one used for VS to launch the exe, this happend).
Thank you for the testcase. This problem is related to getting standard .daConfig file from wrong assembly by DataAbstract that doesn’t include information about Devart driver. Please use the next solution:
public ROServer()
{
InitializeComponent();
// Load DB configurations and project connection configuration
string lFolder = Path.GetDirectoryName(typeof(ROServer).Assembly.Location);
DataFolder = Path.GetFullPath(Path.Combine(lFolder, "..", "Data"));
//RemObjects.DataAbstract.Server.Configuration.Load();
if (!RemObjects.DataAbstract.Server.Configuration.Loaded)
{
//RemObjects.DataAbstract.Server.Configuration.LoadFromResource();
RemObjects.DataAbstract.Server.ConfigurationAccess.RetrieveConfig("DataAbstract.daConfig",Assembly.GetExecutingAssembly(), out doc);
RemObjects.DataAbstract.Server.Configuration.LoadFromXml(doc);
}
//ConnectionManager.LoadFromFile(Path.Combine(DataFolder, "BestSeller.daConnections"));
XmlDocument lConnectionsXml = new XmlDocument();
lConnectionsXml.Load(typeof(Engine).Assembly.GetManifestResourceStream(typeof(Engine).Assembly.GetName().Name + ".daConnections")); //argument - path to BestSeller.daConnections
this.connectionManager.LoadFromXml(lConnectionsXml);
foreach (ConnectionDefinition c in ConnectionManager.ConnectionDefinitions)
{
c.ConnectionString = c.ConnectionString.Replace('\\', Path.DirectorySeparatorChar);
c.ConnectionString = c.ConnectionString.Replace("%SERVER%", lFolder);
}
JsonMessage.SessionIdAsId = true;
HttpDirectoryDispatcher lPathDispatcher = new HttpDirectoryDispatcher();
lPathDispatcher.Path = "/javascript";
lPathDispatcher.Directory = Path.Combine(lFolder, "javascript");
lPathDispatcher.Server = ServerChannel;
}