c# - Use two identical classes/interfaces under different namespaces interchangeably? -
i'm writing web application want allow 3rd party developers write "plugins" can loaded application modify behaviour standard.
so conventional wisdom suggest having this:
public interface iplugin { void execute (iplugincontext context); }
third party developers can implement interface, monkey around context, register code application execute (usually attached message , pre/post condition).
my problem how expose these interfaces. simplest thing seems create myapplication.sdk
library has interfaces , classes want expose. means main application needs reference library, sdk being used build application, sounds little back-to-front.
is there anyway have iplugin interface in both applications , main web application use sdk's iplugin interface if own? in both identical?
when build pluginable system, interfaces , supporting classes want expose plugin authors contract between , plugin authors. therefore, right both application , plugins reference same contract library. therefore should put interfaces , supporting classes plugin architecture sdk library.
also, having sdk library, can release new versions in new libraries later , potentially support multiple versions of plugin interfaces allow evolve capability on time while maintaining backwards compatibility.
Comments
Post a Comment