I'm trying to use XSockets to implement a server, and I want to abstract the DB layer using DI.
This is what I have:
public class FooController : XSocketController
{
// constructor
public FooController()
{
// initialize some data here
}
//... rest of class
}
This is what I want (in order to be able to use some DI on the controller which serves as server) :
public class FooController : XSocketController
{
private IBar _myBar;
// constructor
public FooController(IBar BarImplementation)
{
// ...
_myBar = BarImplementation;
}
//...
}
The problem is: I don't actually create the FooController myself, it's being called when some clients try to connect to it.
This is a typical usage to start your server:
_serverContainer = Composable.GetExport<IXSocketServerContainer>();
_serverContainer.StartServers();
// Write info for each server found.
foreach (var server in _serverContainer.Servers)
{
Console.WriteLine(server.ConfigurationSetting.Endpoint);
Console.WriteLine( "Allowed Connections (0 = infinite): {0}",
server.ConfigurationSetting.NumberOfAllowedConections);
}
If I'm not mistaken (and I might well be), when a client tries to connect he gets he's own private controller as a server.
Any ideas on how this can be solved ?