@ -1,3 +1,56 @@ |
|||
# Plug-In Modules |
|||
|
|||
TODO |
|||
It is possible to load [modules](Module-Development-Basics.md) as plug-ins. That means you may not reference to a module's assembly in your solution, but you can load that module in the application startup just like any other module. |
|||
|
|||
## Basic Usage |
|||
|
|||
`IServiceCollection.AddApplication<T>()` extension method can get options to configure the plug-in sources. |
|||
|
|||
**Example: Load plugins from a folder** |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace MyPlugInDemo.Web |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<MyPlugInDemoWebModule>(options => |
|||
{ |
|||
options.PlugInSources.AddFolder(@"D:\Temp\MyPlugIns"); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
* This is the `Startup` class of a typical ASP.NET Core application. |
|||
* `PlugInSources.AddFolder` gets a folder path and to load assemblies (typically `dll`s) in that folder. |
|||
|
|||
That's all. ABP will discover the modules in the given folder, configure and initialize them just like regular modules. |
|||
|
|||
### Plug-In Sources |
|||
|
|||
`options.PlugInSources` is actually a list of `IPlugInSource` implementations and `AddFolder` is just a shortcut for the following expression: |
|||
|
|||
````csharp |
|||
options.PlugInSources.Add(new FolderPlugInSource(@"D:\Temp\MyPlugIns")); |
|||
```` |
|||
|
|||
> `AddFolder()` only looks for the assembly file in the given folder, but not looks for the sub-folders. You can pass `SearchOption.AllDirectories` as a second parameter to explore plug-ins also from the sub-folders, recursively. |
|||
|
|||
There are two more built-in Plug-In Source implementations: |
|||
|
|||
* `PlugInSources.AddFiles()` gets a list of assembly (typically `dll`) files. This is a shortcut of using `FilePlugInSource` class. |
|||
* `PlugInSources.AddTypes()` gets a list of module class types. If you use this, you need to load the assemblies of the modules yourself, but it provides flexibility when needed. This is a shortcut of using `TypePlugInSource` class. |
|||
|
|||
If you need, you can create your own `IPlugInSource` implementation and add to the `options.PlugInSources` just like the others. |
|||
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 256 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 255 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 294 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 211 KiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 251 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 948 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 31 KiB |