Unity with .Net Remoting

Oct 20, 2011 at 4:45 AM

Hi All,

I have a class which takes dependencies in its constructor.

When client makes a .Net Remoting call to this class, the remoting infrastructure will invoke it but it will not be able to supply the dependencies.

I want to instantiate my object using Unity and fit it in Remoting infrastructure. So, how do I plugin Unity in between. I want a SingleCall type of instance.





Oct 20, 2011 at 7:53 AM
Edited Oct 20, 2011 at 7:53 AM

If you are using Single Call objects then you can only call the default constructor.  If you want to call a non-default constructor you will have to use Client-activated objects.

-- Randy

Oct 20, 2011 at 8:05 AM

But, how do I do Dependency Injection in this case?

Oct 21, 2011 at 2:53 AM

I'm not sure if you can.  If you are using SingleCall objects then they are stateless.  That's why you can only call the default constructor.  
Since they are stateless you won't be able to do constructor, property or method injection.  Can you use Client Activated Objects?

Oct 21, 2011 at 4:15 AM

I used Dependency() attribute and used _container.BuildUp in default parameterless constructor. This solved the issue.