Using IOC in a remote scenario

I'm struggling to get the IOC to work in a delete script. I have an application server configured to publish services (SingleCall) that are configured through XML.

This works the way we all know:

RemotingConfiguration.Configure(ConfigFile, true);

says my service looks like this (pseudo code)

public class TourService : ITourService
{
    IRepository _repository;
    public TourService()
    {
         _repository = new SqlServerRepository();   
    }
}

But I would like it to look like this:

public class TourService : ITourService
{
    IRepository _repository;
    public TourService(IRepository repository)
    {
         _repository = repository;   
    }
}

On the client side, we do something like this (pseudo code again):

(ITourService)Activator.GetObject(ITourService, tcp://server/uri);

You will be asked to create a new instance of my TourService class ...

However, this does not work so well because .NET Remoting Infrastructure wants to know the type , , , , . , IOC - , , Windsor.

...

+3
1

Windsor, Remoting Facility, . .

+1

Source: https://habr.com/ru/post/1737236/


All Articles