CoreFlex.Module
0.1.4
dotnet add package CoreFlex.Module --version 0.1.4
NuGet\Install-Package CoreFlex.Module -Version 0.1.4
<PackageReference Include="CoreFlex.Module" Version="0.1.4" />
paket add CoreFlex.Module --version 0.1.4
#r "nuget: CoreFlex.Module, 0.1.4"
// Install CoreFlex.Module as a Cake Addin #addin nuget:?package=CoreFlex.Module&version=0.1.4 // Install CoreFlex.Module as a Cake Tool #tool nuget:?package=CoreFlex.Module&version=0.1.4
Core Flex模块
Core Flex的核心设计,Core Flex其他模块都是基于Core Flex的核心设计来实现的。 Core Flex模块提供了一些基础的功能,包括: - 模块化 - 自动依赖注入
简单使用
- 安装
NuGet
包
<PackageReference Include="CoreFlex.Module" Version="模块版本" />
- 添加对应模块方法,比如项目名
CoreFlex.Razor.JsInterop
,那么模块名称则是CoreFlexRazorJsInteropModule
,这样的好处就是可以通过模块名称来查找对应的模块,而不是通过文件夹名称来查找模块,这样可以避免文件夹名称和模块名称不一致的问题。
public class CoreFlexRazorJsInteropModule : CoreFlexModule
{
public override void ConfigureServices(CoreFlexServiceContext services)
{
}
public override void OnApplicationShutdown(CoreFlexBuilder app)
{
}
}
创建的模块必须继承CoreFlexModule
,然后实现ConfigureServices
和OnApplicationShutdown
方法,这两个方法是模块的生命周期方法,ConfigureServices
方法在模块加载时调用,OnApplicationShutdown
方法在模块构建完成调用。
模块中也提供了Async
结束的异步回调,以便于在模块加载完成后,可以执行一些异步操作,比如加载一些配置文件等。
当然,如果你的模块需要使用其他的模块,你可以在模块类的上面添加特性[DependsOn(typeof(CoreFlexRazorModule))]
,CoreFlexRazorModule
则是你要依赖的模块,当然它也支持多个模块的依赖;
这样在加载模块时,会先加载CoreFlexRazorModule
模块,
但是如果没有设置特定模块执行顺序,依赖模块将在当前模块的后面执行。
[DependsOn(typeof(CoreFlexRazorModule))]
public class CoreFlexRazorJsInteropModule : CoreFlexModule
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
-
net7.0
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.0)
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CoreFlex.Module:
Package | Downloads |
---|---|
CoreFlex.Razor.JsInterop
Package Description |
|
CoreFlex.Event
Package Description |
|
CoreFlex.Jwt
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.