I am trying to use DynamicProxy to generate a proxy without a target, when a method on the proxy is invoked, I would like to serialize the IInvocation to then be passed to another process (on another machine) that will use an IOC container to resolve the target type and carry out the invocation on its new resolved target.
My invocation receiver would look something like the following:
public class InvocationReceiver
{
private readonly UnityContainer _container;
public InvocationReceiver(UnityContainer container)
{
_container = container;
}
public void ReceiveInvocation(Castle.DynamicProxy.IInvocation invocation)
{
var target = _container.Resolve(invocation.TargetType);
Invoke(invocation, target); //Something like this
}
}
I'm not sure if I am taking the right approach, that being said, is there a helper in the lib that would allow me to do this?