Dynamically choose DataAbstract connection based on RO call

So what if the user needs to be able to switch between several connections without relogin?

The most obvious solution would be to create a set of service method that would set corresponding session value.
However this approach should be used carefully to ensure that race conditions never occur. The most obvious sample of such race condition is a situation when data is accessed for the same user from several threads and each thread needs to use its own connection. In this case it is not possible to set connection via user session as it will be used for requests from different threads.

Take a look at this data access code:

			Console.WriteLine("Press ENTER to access data!");
			Console.ReadLine();


			var dataModule = new DataModule();

			dataModule.DataAdapter.RemoteService.ServiceName = "DataService.PCTrade-SQLite";

			dataModule.LogOn("test", "test");
			var query = from x in dataModule.DataAdapter.GetTable<Orders>() select x;
			var data = query.ToList();
			Console.WriteLine("Count: " + data.Count);

			Console.ReadLine();

It is a very simple data request code with a singe non-usual code line where the ServiceName is set. Additional data is passed to the server via service name suffix. Let’s take a look hot to use this data:

	public class DataService : RemObjects.DataAbstract.Server.DataAbstractService, IMessageAwareService
	{
		public DataService()
		{
			this.InitializeComponent();
		}

		private void InitializeComponent()
		{
			RemObjects.DataAbstract.Bin2DataStreamer dataStreamer;
			dataStreamer = new RemObjects.DataAbstract.Bin2DataStreamer();
			this.AcquireConnection = false;
			this.ServiceDataStreamer = dataStreamer;
			this.ServiceSchemaName = "NetCoreApplication3Dataset";
		}

		public void OnServiceActivated(IMessage message)
		{
			var requestName = message.InterfaceName;

			var pos = requestName.IndexOf('.');

			this.ConnectionName = (pos > 1) ? requestName.Substring(pos + 1) : "";
			this.AcquireConnection = true;
			this.Connection = this.GetConnection();
		}
	}

The IMessageAwareService allows to access additional data about the incoming service request. This allows to ;extract additional data from the service request and to use this data to acquire requested data connection.

EDIT: Logged an issue to add this topic into documentation.

@fvancrae