Our server loads schema definitions for databases dynamically based on connection strings stored in a local SQLite database. That all works, but I want to be able to provide a client side capability to “reload” the server based on changes made to the connection strings stored in the SQLite database. Simply stopping and starting the server application would achieve the same thing, but to cater for those occasions where we don’t have ready access to the server application (on customer sites) I’d like to be able to force the server to take notice of revised definitions that have been saved back to the local “admin” SQLite database.
In practice this should mean calling a method in the main server code from one of the services exposed to the client application. For example calling Main.Engine.Reload from a client AdminService.Reload method where Engine holds the channel,connectionmanage, session manager etc. I wouldn’t want or need to deactive/active the channel (and lose connection to the client), just call a method that clears the ConnectionManager.ConnectionDefinitions and reloads them. Is there a safe way to make such a call and if so can you give me an example line(s) of code for calling a server method from inside a service (.NET / Oxygene).
I wouldn’t want or need to deactive/active the channel (and lose connection to the client), just call a method that clears the ConnectionManager.ConnectionDefinitions and reloads them. Is there a safe way to make such a call and if so can you give me an example line(s) of code for calling a server method from inside a service (.NET / Oxygene).
Please consider to use the next approach:
Create new service’s custom method that will clear and then load connections.
Make connectionManager as public static member and add the next implementation for this custom method:
.NET:
public void CustomMethod()
{
Engine.connectionManager.ConnectionDefinitions.Clear();
Engine.connectionManager.Load();
}
Oxygene:
method CustomMethod;
begin
Engine.connectionManager.ConnectionDefinitions.Clear();
Engine.connectionManager.Load()
end;
Call CustomMethod on the client side as usually:
.NET:
IDataService service = CoDataService.Create(this.fDataModule.message, this.fDataModule.clientChannel);
service.NewMethod();
Oxygene:
var service: IDataService := CoDataService.Create(self.fDataModule.message, self.fDataModule.clientChannel);
service.NewMethod();