Forward and backward compatibility plugin architecture

I am currently working on a C # product that will use a plugin type system. This is not something new, and I learned a lot about how to use the interface to implement this function quite easily.

I also saw ways to implement backward compatibility by updating the interface name, for example: Changing the interface between versions - how to manage?

There are several scenarios that I can foresee with our product regarding version mismatches between the main exe and the plugin.

  • The main program, the same version of the plugin as the plugin
  • The main program, newer than the plugin
  • Main program older than plugin

From the information that I was able to collect 1 and 2, everything is fine. But I could not understand how to correctly implement “advanced” compatibility (3).

We intend to use only ADD methods for the plugin API.

Any ideas would be a big help.

+5
source share
2 answers

PluginAPI Isolated DLL

Firstly, your PluginAPI (containing the interfaces) should be a separate DLL for your main application. Your main application will reference PluginAPI, and each plugin will reference PluginAPI. You are most likely already doing this.

Interface Versions

Secondly, structurally, you must create a new interface every time you add a new property or method.

For instance:

  • Version 1: .IPerson Plugins
  • 2: .V2.IPerson: .IPerson
  • 3: .V3.IPerson: Plugins.V2.IPerson

, API, :

  1. 4: Plugins.V4.IPerson//

DLL- PluginAPI

, 100%, DLL PluginAPI .

, dll ( ()). , .

3

, [3], :

  • Person Plugins.V2.IPlugin V3.dll( ).
  • V1.dll
  • .dlls V2 V3.
  • .dll V1 ( ).
  • Person V1 IPerson.
  • , V1
  • ( - , )

, . , , , . . , . , .

, "" :

  • . . , , , i) ; ii) . , . . [2], .
  • - AppDomain. AppDomains , - . . , : i) - /, ii) ( ), iii) .

, [2] , [1] , , [2]. -. , [2] , , , , ( ).

+2

, (). , , . , main. , , .

0

All Articles