Token.Module
1.1.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Token.Module --version 1.1.6
NuGet\Install-Package Token.Module -Version 1.1.6
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.1.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Token.Module" Version="1.1.6" />
<PackageReference Include="Token.Module" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Token.Module --version 1.1.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Token.Module, 1.1.6"
#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.
#:package Token.Module@1.1.6
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Token.Module&version=1.1.6
#tool nuget:?package=Token.Module&version=1.1.6
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))] 这样就可以按照传入顺序一并执行
// 默认自动依赖注入继承指定依赖生命周期的接口
builder.Services.AddTagApplication<NetCoreTestModule>();
// 这样将不会自动依赖注入
builder.Services.AddTagApplication<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实践去项目划分
测试
在test文件中存在简单的使用示例
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 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Options (>= 6.0.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.EntityFrameworkCore
Package Description |
|
Token.Auditing
简易可扩展的审计日志 |
|
Token.EntityFrameworkCore.MySql
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.3.4 | 616 | 11/25/2022 |
1.3.1 | 1,043 | 10/28/2022 |
1.3.0 | 517 | 10/28/2022 |
1.2.9 | 584 | 10/22/2022 |
1.2.8 | 586 | 9/30/2022 |
1.2.7 | 564 | 9/30/2022 |
1.2.6 | 591 | 9/3/2022 |
1.2.5 | 557 | 8/31/2022 |
1.2.4 | 544 | 8/31/2022 |
1.2.3 | 899 | 8/29/2022 |
1.2.2 | 561 | 8/17/2022 |
1.2.1 | 961 | 7/29/2022 |
1.2.0 | 867 | 7/8/2022 |
1.1.9 | 591 | 7/7/2022 |
1.1.8 | 576 | 7/7/2022 |
1.1.7 | 653 | 7/7/2022 |
1.1.6 | 575 | 7/7/2022 |
1.1.5 | 598 | 7/7/2022 |
1.1.4 | 578 | 7/7/2022 |
1.1.3 | 580 | 7/6/2022 |
1.1.1 | 576 | 7/6/2022 |
1.1.0 | 591 | 7/6/2022 |
1.0.1 | 584 | 7/6/2022 |
1.0.0 | 596 | 7/5/2022 |
新增Configure方法