At present, only the basic functions have been done, such as:
Separate AppDomain containers for each module
Activator activation
Exported service Checks
However, although this, but the current version has been able to achieve module separation, interdependence and other functions, the module division has been very good role.
First, the basic structure:
Currently, this framework does not support the modularity of the UI, it only supports module loading under a single machine (which will be improved later).
Characteristics:
Runtime, Module1, Module2, Module3 are all running under their own AppDomain, without interfering with each other.
By loading the module in an isolated AppDomain way, you can easily uninstall tasks such as AppDomain, a DLL, DLL version switching, and facilitate subsequent extensions
To see how the module is written.
The Ordermodule library is the main business logic and the location of the module definition
Ordermodule.publicinterfaces are common definitions, such as interfaces, events, DTO, etc. that are independent (if you don't mind this, and can be merged into a single library), given the convenience of distribution.
Module definition file:
<?xml version= "1.0" encoding= "Utf-8"?>
<Module>
<name>order
module</name> <Version>1</Version>
<Assembly>OrderModule</Assembly>
<Activator> Ordermodule.activator</activator> //This is the
first ClassType of the OSGi call, which will execute the 2 methods inside: Start and stop
< Requiredservice>loggingmodule.publicinterfaces.ilog</required
service>//which other Service the module needs to rely on, can have multiple
<ProvidedService>OrderModule.PublicInterfaces.IOrderProcessor<
/providedservice>// This module will provide services that can have multiple
</Module>
Activator:
Class Activator:OSGIFramework.BundleActivator
{public
override void Startup (bundlecontext BC)
{
Console.WriteLine ("Ordermodule Startup");
Bundlecontext.current.registerprovidedservice<iorderprocessor, orderprocessorimpl> ();
Registration Service
} public
override void Stop (bundlecontext BC)
{
Console.WriteLine ("Ordermodule Stop");
Bundlecontext.current.unregisterprovidedservice<iorderprocessor,
orderprocessorimpl> ();
Uninstall Service
}
}