mercredi 29 juin 2016

ASP.NET Dynamically Load Implemenations at runtime

I'm writing an ASP.NET API for a client who needs multiple implementations of some specific code to access various versions of a 3rd party API.

Writing a windows application I'd just use reflection but not sure if that's a) the best way to go for IIS or b) why I'm getting so many problems trying to load a type from a dll under the bin directory (copied in rather than a dependency). Using reflection I'm able to get the type but creating an Instance of it using Activator.CreateInstance seems to give be just a system object rather than the type implementation.

So my question is does reflection seem the right way to go or should I take note that ASP doesn't seem to like loading the type in at runtime and instead compile all implementations of the 3rd party wrapper dlls and use a factory to return the right implementation (downside being all versions will be included in the software)

Cheers





Aucun commentaire:

Enregistrer un commentaire