Token.Module
1.3.4
dotnet add package Token.Module --version 1.3.4
NuGet\Install-Package Token.Module -Version 1.3.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Token.Module" Version="1.3.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Token.Module --version 1.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Token.Module, 1.3.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Token.Module as a Cake Addin #addin nuget:?package=Token.Module&version=1.3.4 // Install Token.Module as a Cake Tool #tool nuget:?package=Token.Module&version=1.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TokenModule
介绍
模块注入模块引用 设计灵感来源于ABPModule,简化了很多没有必要的依赖,可自动扩展工具 /test/的Demo项目是一个完整的项目示例,有兴趣的可以查看阅读
使用教程
using Token.Module.Extensions;
using NetCoreTest;
var builder = WebApplication.CreateBuilder(args);
// 执行这一步的时候就会先执行NetCoreTestModule里面的 ConfigureService方法,
// 执行顺序ConfigureServicesAsync =》ConfigureService方法
// 如果NetCoreTestModule中使用了[DependOn(typeof(其他的Module))] 这样就可以按照传入顺序一并执行
// 默认自动依赖注入继承指定依赖生命周期的接口
await builder.Services.AddModuleApplicationAsync<NetCoreTestModule>();
// 这样将不会自动依赖注入
builder.Services.AddModuleApplication<NetCoreTestModule>(false);
var app = builder.Build();
// 执行这一步的时候就会先执行NetCoreTestModule里面的 OnApplicationShutdown,
// OnApplicationShutdownAsync =》OnApplicationShutdown方法
app.InitializeApplication();
app.Run();
自动依赖注入
// 如果没有取消自动注入的话,您只需要在实现类继承相应的接口即可 // 接口的名字和实现类型的名字必须基本一致,接口多加I其他的名字必须一致
IScopedDependency ⇒ services.AddScoped();
ISingletonDependency ⇒ service.AddSingleton();
ITransientDependency ⇒ service.AddTransient();
示例
// 接口
public interface IDemoService
{
Task<string> GetAsync();
Task UpdateAsync(Guid id,string data);
}
// 实现类
public class DemoService : IDemoService, ISingletonDependency
{
public Task<string> GetAsync()
{
return Task.FromResult("ok");
}
public async Task UpdateAsync(Guid id, string data)
{
await Task.CompletedTask;
}
}
// 只需要按照这个示例就可以完成注入了,必须是未忽略自动注入才会注入
// 建议按照abp官方的DDD实践去项目划分
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0)
- Microsoft.Extensions.Options (>= 2.1.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Token.Module:
Package | Downloads |
---|---|
Token.Domain
Package Description |
|
Token.Uow
Package Description |
|
Token.Auditing
简易可扩展的审计日志 |
|
Token.EntityFrameworkCore
Package Description |
|
Token.EntityFrameworkCore.MySql
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.3.4 | 504 | 11/25/2022 |
1.3.1 | 917 | 10/28/2022 |
1.3.0 | 416 | 10/28/2022 |
1.2.9 | 482 | 10/22/2022 |
1.2.8 | 500 | 9/30/2022 |
1.2.7 | 457 | 9/30/2022 |
1.2.6 | 488 | 9/3/2022 |
1.2.5 | 450 | 8/31/2022 |
1.2.4 | 436 | 8/31/2022 |
1.2.3 | 775 | 8/29/2022 |
1.2.2 | 452 | 8/17/2022 |
1.2.1 | 815 | 7/29/2022 |
1.2.0 | 705 | 7/8/2022 |
1.1.9 | 487 | 7/7/2022 |
1.1.8 | 469 | 7/7/2022 |
1.1.7 | 535 | 7/7/2022 |
1.1.6 | 471 | 7/7/2022 |
1.1.5 | 492 | 7/7/2022 |
1.1.4 | 481 | 7/7/2022 |
1.1.3 | 474 | 7/6/2022 |
1.1.1 | 470 | 7/6/2022 |
1.1.0 | 487 | 7/6/2022 |
1.0.1 | 481 | 7/6/2022 |
1.0.0 | 487 | 7/5/2022 |
增加禁用注入特性