FBW.DotNet.AspNetCore
1.0.4
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
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 FBW.DotNet.AspNetCore --version 1.0.4
NuGet\Install-Package FBW.DotNet.AspNetCore -Version 1.0.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="FBW.DotNet.AspNetCore" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FBW.DotNet.AspNetCore --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FBW.DotNet.AspNetCore, 1.0.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 FBW.DotNet.AspNetCore as a Cake Addin #addin nuget:?package=FBW.DotNet.AspNetCore&version=1.0.4 // Install FBW.DotNet.AspNetCore as a Cake Tool #tool nuget:?package=FBW.DotNet.AspNetCore&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FBW.DotNet.AspNetCore
ASP.NET Core扩展包,目前支持.NET3.1,.NET5,.NET6,.NET7,.NET8
如何使用
1、安装FBW.DotNet.AspNetCore
依赖。
Cmd install:
dotnet add package FBW.DotNet.AspNetCore
2、在Startup.cs
中配置
//Identity相关配置
builder.Services.AddDefaultIdentityConfiguration().AddIdentityNpgsqlStore(new IdentityOptions(
configuration["SystemConfig:DBConnectionString"],
configuration["SystemConfig:PrivateKey"],
configuration.GetSection("RedisConfig").Get<RedisOptions>()
)).AddResourceOwnerValidator<ResourceOwnerPasswordValidator>();
//jwt相关配置
builder.Services.AddDotNetJwtBearerAuthentication(configuration["SystemConfig:PublicKey"],configuration["SystemConfig:ValidIssuer"]);
//Mvc相关配置
builder.Services.AddDotNetDefaultMvc();
//SwaggerDoc配置
builder.Services.AddSwaggerDoc(configuration.GetSection("SwaggerConfig").Get<SwaggerConfig>());
var app = builder.Build();
app.UseDotNetDefaultMvc();
app.UseSwaggerUI(configuration.GetSection("SwaggerConfig").Get<SwaggerConfig>());
app.UseIdentityServer();
3、 appsettings.json配置文件实例:
{
//接口文档配置
"SwaggerConfig": {
"Title": "DotNet.Admin.Web",
"Version": "v1",
"Description": "DotNet.Admin.Web",
"Name": "DotNet",
"Email": "2231030106@qq.com",
"ProxyRoutes": {
//"localhost": "http://127.0.0.1:6033/IdentityServer"
}
},
//redis 配置
"RedisConfig": {
"Connection": "127.0.0.1:6379,password=123456",
"KeyPrefix": "dotnetadminweb",
"DefaultDatabase": 0,
"DataProtecteKey": "DotNet.Admin.Web:DataProtection-Keys",
"IsSentinel": false, // 是否哨兵模式
"SentinelConfig": {
"DefaultDatabase": "4",
"EndPoints": [ // 哨兵端口
// "10.10.0.124:26380"
],
"Password": "123456",
"SentinelPassword": "123456",
"ServiceName": "dotnetadminweb"
}
},
//系统配置
"SystemConfig": {
"ValidIssuer": "https://localhost:44354",
"DatabaseVisitLogSleep": 10000,//系统日志入库时间
"DBConnectionString": "Host=127.0.0.1;Username=postgres;Password=123456;Database=DotNet_Template",
"PublicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiQPMKq+BQIhoImH30v8FH02x8S8Bz6+ROwzidBEk8C2BidnnMFs2OeXQeHRW7HSJRAhTVTBwhWoJ+3G/C2L6FiMLYPgaKpWsacqZPkbcgpHKfQLJn1weXeZqLNeZKi+aebOX27JOt9cph/YVb5hBTgVzl5q7yASOEg9+wV/y1d8Jq4EAlzXdAux+JRgMGQgj8CSPSSY1z2PO4iZProdgFa/dto8AlVRabVCTx6BoCnMrImy2XRHdF0Ue0eY5mtAAsnLudjKqm8AUopMOivNCLVI5eXzMIoMmpa0bUj7IluoushYVLY0dw7flyKldiDbyvi4w/jrxHRruNMb11fNEFQIDAQAB",
"PrivateKey": "MIIEowIBAAKCAQEAiQPMKq+BQIhoImH30v8FH02x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9jjPCOXN0JcoDYiNHY8K+tUL1AufVGolOz7fgr58mr/RGRRR9fqAbjCXQC6OS/sCUnfeO594z0nFjh27VWP84lrpgG5btUVuCrv2n0+Lq08SxKU9oR5mJ5ECgYBnPEs2xtIQlBoCV0F5jsj41D5LCY7qqBBJ0JQv/DumbMi8jl5f8p+9tVlDI8eP5wXPC1v8TZX4Zv1KVmZnnGUIDaD9HcE5a76nEKIaZDJCtBVc6+GdDMzj45wGgIr6sTuVPPD6R0xEtLrVMaIke6cvXV1GnBudTw18L8Vn2YnSBQKBgG/NxXjh+urIa+qsIzNHbrTCt+qGsix8z1f7s1OwTlVksFW3otaNK2hIDMlslUgRnVzjZfPyzKME/EuA/WjqAn/ZxqDR1TYvgxil8EaBn9jTEL7LO06ggCuh1dnmPrzC06no5E6Gj4m+6tknO5K5/NU/2HqQnaR6IB514ut7URba"
}
}
4、Efcore迁移
add-migration Ids4Config001 -c IdentityContext -o Migrations/Ids4Config
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- AutoMapper (>= 12.0.1)
- AutoMapper.Extensions.Microsoft.DependencyInjection (>= 12.0.1)
- EFCore.NamingConventions (>= 5.0.2)
- FastMember (>= 1.5.0)
- IdentityServer4 (>= 4.1.2)
- IGeekFan.AspNetCore.Knife4jUI (>= 0.0.16)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 3.1.32)
- Microsoft.AspNetCore.DataProtection.StackExchangeRedis (>= 5.0.17)
- Microsoft.EntityFrameworkCore (>= 5.0.17)
- Microsoft.EntityFrameworkCore.Relational (>= 5.0.17)
- Microsoft.EntityFrameworkCore.SqlServer (>= 5.0.17)
- Microsoft.Extensions.DependencyInjection (>= 5.0.2)
- MiniProfiler.AspNetCore.Mvc (>= 4.2.22)
- MiniProfiler.EntityFrameworkCore (>= 4.2.22)
- Namotion.Reflection (>= 3.1.1)
- NLog.Web.AspNetCore (>= 5.3.11)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 5.0.0)
- OnceMi.AspNetCore.IdGenerator (>= 1.0.6)
- Polly (>= 8.4.0)
- Pomelo.EntityFrameworkCore.MySql (>= 5.0.0)
- RazorEngine.NetCore (>= 3.1.0)
- RSAExtensions (>= 1.1.2)
- StackExchange.Redis.Extensions.Core (>= 10.2.0)
- StackExchange.Redis.Extensions.System.Text.Json (>= 10.2.0)
- Swashbuckle.AspNetCore.Annotations (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2)
- System.Text.RegularExpressions (>= 4.3.1)
-
net5.0
- AutoMapper (>= 12.0.1)
- AutoMapper.Extensions.Microsoft.DependencyInjection (>= 12.0.1)
- EFCore.NamingConventions (>= 5.0.2)
- FastMember (>= 1.5.0)
- IdentityServer4 (>= 4.1.2)
- IGeekFan.AspNetCore.Knife4jUI (>= 0.0.16)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 5.0.17)
- Microsoft.AspNetCore.DataProtection.StackExchangeRedis (>= 5.0.17)
- Microsoft.EntityFrameworkCore (>= 5.0.17)
- Microsoft.EntityFrameworkCore.Relational (>= 5.0.17)
- Microsoft.EntityFrameworkCore.SqlServer (>= 5.0.17)
- Microsoft.Extensions.DependencyInjection (>= 5.0.2)
- MiniProfiler.AspNetCore.Mvc (>= 4.2.22)
- MiniProfiler.EntityFrameworkCore (>= 4.2.22)
- Namotion.Reflection (>= 3.1.1)
- NLog.Web.AspNetCore (>= 5.3.11)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 5.0.0)
- OnceMi.AspNetCore.IdGenerator (>= 1.0.6)
- Polly (>= 8.4.0)
- Pomelo.EntityFrameworkCore.MySql (>= 5.0.0)
- RazorEngine.NetCore (>= 3.1.0)
- RSAExtensions (>= 1.1.2)
- StackExchange.Redis.Extensions.Core (>= 10.2.0)
- StackExchange.Redis.Extensions.System.Text.Json (>= 10.2.0)
- Swashbuckle.AspNetCore.Annotations (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2)
- System.Text.RegularExpressions (>= 4.3.1)
-
net6.0
- Asp.Versioning.Mvc.ApiExplorer (>= 6.4.0)
- AutoMapper (>= 13.0.1)
- EFCore.NamingConventions (>= 7.0.2)
- FastMember (>= 1.5.0)
- IdentityServer4 (>= 4.1.2)
- IGeekFan.AspNetCore.Knife4jUI (>= 0.0.16)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 6.0.30)
- Microsoft.AspNetCore.DataProtection.StackExchangeRedis (>= 6.0.31)
- Microsoft.EntityFrameworkCore (>= 7.0.19)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.19)
- Microsoft.EntityFrameworkCore.SqlServer (>= 7.0.19)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- MiniProfiler.AspNetCore.Mvc (>= 4.3.8)
- MiniProfiler.EntityFrameworkCore (>= 4.3.8)
- Namotion.Reflection (>= 3.1.1)
- NLog.Web.AspNetCore (>= 5.3.11)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 7.0.18)
- OnceMi.AspNetCore.IdGenerator (>= 1.0.6)
- Polly (>= 8.4.0)
- Pomelo.EntityFrameworkCore.MySql (>= 7.0.0)
- RazorEngine.NetCore (>= 3.1.0)
- RSAExtensions (>= 1.1.2)
- StackExchange.Redis.Extensions.Core (>= 10.2.0)
- StackExchange.Redis.Extensions.System.Text.Json (>= 10.2.0)
- Swashbuckle.AspNetCore.Annotations (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2)
- System.Text.RegularExpressions (>= 4.3.1)
-
net7.0
- Asp.Versioning.Mvc.ApiExplorer (>= 7.1.0)
- AutoMapper (>= 13.0.1)
- EFCore.NamingConventions (>= 7.0.2)
- FastMember (>= 1.5.0)
- IdentityServer4 (>= 4.1.2)
- IGeekFan.AspNetCore.Knife4jUI (>= 0.0.16)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 7.0.19)
- Microsoft.AspNetCore.DataProtection.StackExchangeRedis (>= 7.0.20)
- Microsoft.EntityFrameworkCore (>= 7.0.19)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.19)
- Microsoft.EntityFrameworkCore.SqlServer (>= 7.0.19)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- MiniProfiler.AspNetCore.Mvc (>= 4.3.8)
- MiniProfiler.EntityFrameworkCore (>= 4.3.8)
- Namotion.Reflection (>= 3.1.1)
- NLog.Web.AspNetCore (>= 5.3.11)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 7.0.18)
- OnceMi.AspNetCore.IdGenerator (>= 1.0.6)
- Polly (>= 8.4.0)
- Pomelo.EntityFrameworkCore.MySql (>= 7.0.0)
- RazorEngine.NetCore (>= 3.1.0)
- RSAExtensions (>= 1.1.2)
- StackExchange.Redis.Extensions.Core (>= 10.2.0)
- StackExchange.Redis.Extensions.System.Text.Json (>= 10.2.0)
- Swashbuckle.AspNetCore.Annotations (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2)
- System.Text.RegularExpressions (>= 4.3.1)
-
net8.0
- Asp.Versioning.Mvc.ApiExplorer (>= 8.1.0)
- AutoMapper (>= 13.0.1)
- EFCore.NamingConventions (>= 8.0.3)
- FastMember (>= 1.5.0)
- IdentityServer4 (>= 4.1.2)
- IGeekFan.AspNetCore.Knife4jUI (>= 0.0.16)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.6)
- Microsoft.AspNetCore.DataProtection.StackExchangeRedis (>= 8.0.6)
- Microsoft.EntityFrameworkCore (>= 8.0.6)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.6)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.6)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- MiniProfiler.AspNetCore.Mvc (>= 4.3.8)
- MiniProfiler.EntityFrameworkCore (>= 4.3.8)
- Namotion.Reflection (>= 3.1.1)
- NLog.Web.AspNetCore (>= 5.3.11)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 8.0.4)
- OnceMi.AspNetCore.IdGenerator (>= 1.0.6)
- Polly (>= 8.4.0)
- Pomelo.EntityFrameworkCore.MySql (>= 8.0.2)
- RazorEngine.NetCore (>= 3.1.0)
- RSAExtensions (>= 1.1.2)
- StackExchange.Redis.Extensions.Core (>= 10.2.0)
- StackExchange.Redis.Extensions.System.Text.Json (>= 10.2.0)
- Swashbuckle.AspNetCore.Annotations (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.