Token.Module
1.2.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.2.6
NuGet\Install-Package Token.Module -Version 1.2.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.2.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Token.Module --version 1.2.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Token.Module, 1.2.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.
// Install Token.Module as a Cake Addin #addin nuget:?package=Token.Module&version=1.2.6 // Install Token.Module as a Cake Tool #tool nuget:?package=Token.Module&version=1.2.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.AddModuleApplication<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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. 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.0
- 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.Logging.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Options (>= 2.1.0)
-
.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.Logging.Abstractions (>= 2.2.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 | 502 | 11/25/2022 |
1.3.1 | 915 | 10/28/2022 |
1.3.0 | 414 | 10/28/2022 |
1.2.9 | 480 | 10/22/2022 |
1.2.8 | 498 | 9/30/2022 |
1.2.7 | 455 | 9/30/2022 |
1.2.6 | 486 | 9/3/2022 |
1.2.5 | 448 | 8/31/2022 |
1.2.4 | 434 | 8/31/2022 |
1.2.3 | 773 | 8/29/2022 |
1.2.2 | 450 | 8/17/2022 |
1.2.1 | 813 | 7/29/2022 |
1.2.0 | 703 | 7/8/2022 |
1.1.9 | 485 | 7/7/2022 |
1.1.8 | 467 | 7/7/2022 |
1.1.7 | 531 | 7/7/2022 |
1.1.6 | 469 | 7/7/2022 |
1.1.5 | 490 | 7/7/2022 |
1.1.4 | 479 | 7/7/2022 |
1.1.3 | 472 | 7/6/2022 |
1.1.1 | 468 | 7/6/2022 |
1.1.0 | 485 | 7/6/2022 |
1.0.1 | 479 | 7/6/2022 |
1.0.0 | 485 | 7/5/2022 |
新增BusinessException