Can I do this with unity (add reference at runtime)?

Jul 11, 2008 at 4:33 AM
new to Unity and trying to find examples of usage.

I am working on a project where I have to add reference at runtime.The scenario is this:
     Windows Form application
     MyCompany.Payment.PayPal  (01 assembly)
     MyCompany.Payment.WorldPay (01 Assembly)
     MyCompanyPayment.Interfaces (01 assembly)   IPay  (method  Pay-Refund etc..)

My windowsForm app DOES NOT have any reference to both PayPal and WorldPay.

But a runtime i now use reflection to load either one from a folder based on the name and interface

Can somebody provide an example on how i can use Unity to achieve the same?
Is this possible?

thanks a lot .
Jul 11, 2008 at 4:52 AM
Why don't you use SCSF (Smart Client Software Factory)? I think this is what you are looking for. 
Jul 11, 2008 at 8:30 AM
Edited Jul 11, 2008 at 8:32 AM
thanks for your reply.

I dont know anything about SCSF ,not sure if the learning curve is high,then I would have to convince my boss to adopt it and sell it to him.

I am writing something that should be totally pluggable,A plugin architecture.I am a big fan of Enterprise Library,but I am failing to see the how Unity  might be of benefit in a plugin architecture.
I use interfaces all times MVPs etc.. but I have never played with depencyInjection.
I was wondering if Unity fits in a pluggable architecture in the sense I could
    Have a config file where I had My Plugins
    Instantiate dlls using Unity.
    Either webApp or Windows App should have NO reference to the plugin.

So.Still confused.
Can you use Unity as another way to write a plugin architecture?

Jul 11, 2008 at 8:44 AM
Unity is a great tool to wire your plugins together once you've gotten them loaded. It doesn't do anything about the loading process.

You might want to look at the recently released Composite WPF Guidance. That team did a great job of building a plug-in system and leveraging DI containers to the hilt. The loading stuff is pretty UI agnostic, and should apply equally to Winforms.

SCSF and CAB was p&p's previous effort in the composite application space, and while very powerful has a very steep learning curve. The Composite WPF stuff is much simpler to understand.

Jul 11, 2008 at 9:05 AM
Again ,thanks for your time in replying.

I will look at Composite WPF guidance as a learning tool.I hope is very digestable and quick to learn,as I have to put up a quick demo for the weekend.And sell the all concept to my boss to adapt.

Any quick examples anywhere on How I could hook into my plugins using unity.

As they said " a picture says more than a 1000 words".

thanks a lot for any suggestions
Jul 11, 2008 at 9:54 AM
         This is exacly what I wanted to know .I was in the hope that Unity had some clever in built mechanism to load plugins or a wrapper.We still have to write this ourselves.Fair enough.
         At least I now know that I cannot use Unity for this.Thanks

ctavares wrote:
Unity is a great tool to wire your plugins together once you've gotten them loaded. It doesn't do anything about the loading process.