views:

56

answers:

1

Hi,

In my scenario there is a client-side assembly that contains a class (Task). This class implements an interface (ITask) that is known on the server. I'm trying to send a Task object from client to server without copying the assembly of the client manually to the server.

If I just serialize the task object, the server obviously complains about the missing assembly. I then tried to serialze typeof(Task).Assembly but could not derserialize it on the server. Next I tried to File.ReadAllBytes(typeof(Task).Assembly.Location) and saved it to a temporary file on the server, which threw an exception on Assembly.LoadFrom(@".\temporary.dll");

Why am I doing this? Java RMI has a neat feature to request the implementation of an object that is received through remoting but is stil "unkown" (this JVM doesn't have the *.class file). This can be used for a compute server that just knows the interface of a "task" containing a run() method and downloads the implementation of this method on demand. This way the server doesn't have to be changed for new tasks. I'm trying to achieve something like this in .Net.

A: 

Never mind, I found a way that works for me using the AssemblyResolve event and loading the assembly directly from the byte array with

AppDomain.CurrentDomain.Load(assemblyData);

Just in case someone has the same problem.

flogo