In one of the project I’m currently working on, I need to be able to call a function from an assembly that will be provided at run time.
One of the major requirement I have is to have a clear isolation of the call with a minimum of configuration.
The second requirement is to be able to provide a regular configuration file on my callee assembly in order for a lambda developer to implement a WCF call in that assembly using regular config files.
Meaning they should be able to write a simple .NET Assembly referencing other assembly and making use of a config file and all that should work.
There is no particular performance requirement. It is left to the developper of the callee assembly to manage this issue. It will be up to him to dispatch and manage threads if needed.
The easiest solution I found was to create a new app domain. To load the callee assembly in that new domain and to execute the call there. This gave me the isolation level I was needing.
My calling class looks like this
My ProxyComponent.Proxy class looks like this
The only shared assembly bet ween the callee and the caller is the assembly that contains the IScheduler interface.
This could have been avoided using DLR and Dynamic. I’ll try to work on this in a near future.