Access a Remote Object Through an Interface

Problem

You want a client to be able to create a remote object without requiring a reference to the assembly that defines it.

Solution

Create an interface that defines the methods the client needs to access, and distribute an assembly that contains only the interface.

Discussion

One of the limitations with .NET Remoting is that the client needs a local copy of the assembly with the code for the remote object in order to determine what methods are available. This not only poses an additional distribution headache, but it also can compromise security if you don’t want the client to be able to examine the code or create local instances of the classes it contains.

The solution is to create an interface that declares ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.