I'm struggling with getting IOC to work in a remoting scenario. I have my application server set up to publish Services (SingleCall) which are configured via XML.
This works just like this as we all know:
RemotingConfiguration.Configure(ConfigFile, true);
lets say my service looks like that (pseudocode)
public class TourService : ITourService
{
IRepository _repository;
public TourService()
{
_repository = new SqlServerRepository();
}
}
But what I rather would like to have sure looks like this:
public class TourService : ITourService
{
IRepository _repository;
public TourService(IRepository repository)
{
_repository = repository;
}
}
On the client side we do something like that (pseudocode again):
(ITourService)Activator.GetObject(ITourService, tcp://server/uri);
This prompts the server to create a new instance of my TourService class...
However this doesn't seem to work out well because the .NET Remoting Infrastructure want's to know the type it should publish but I would rather like to point it to the way how it could retrieve the object it should publish. In other words, route it through the IOC process pipe of - let's say windsor castle - for example.
Currently I'm a bit lost on that task...