Xunet.Core
1.0.3
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Xunet.Core --version 1.0.3
NuGet\Install-Package Xunet.Core -Version 1.0.3
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="Xunet.Core" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xunet.Core" Version="1.0.3" />
<PackageReference Include="Xunet.Core" />
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 Xunet.Core --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Xunet.Core, 1.0.3"
#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 Xunet.Core@1.0.3
#: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=Xunet.Core&version=1.0.3
#tool nuget:?package=Xunet.Core&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
常用中间件
Xunet.Core 是 .NET Core 的通用中间件库,包含一些常用中间件,用于简化 WebApi 开发。
支持 .NET 6.0、.NET 7.0
全局异常处理中间件、异常日志
NLog日志中间件、操作日志、登录日志,自动分表
缓存中间件、Redis缓存
JWT认证和授权
ORM中间件、SqlSugar、SQL执行日志
对象映射中间件、AutoMapper
Swagger中间件
依赖注入Autofac
FluentValidation验证中间件
跨域中间件
// Program.cs
var builder = WebApplication.CreateBuilder(args);
// 配置Autofac容器 => 批量注入
builder.Host.ConfigureXunetAutofac(new Dictionary<string, Assembly>
{
{ "Service" , ServiceAssembly.Assembly },
{ "Repository" , RepositoryAssembly.Assembly }
});
// 添加Session
builder.Services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromMinutes(20);//设置session过期时间
options.Cookie.IsEssential = true;
});
// 添加Controllers
builder.Services.AddXunetControllers();
// 添加HttpContextHelper
builder.Services.AddXunetHttpContextHelper();
// 添加FluentValidation
builder.Services.AddXunetFluentValidation(ServiceAssembly.Assembly);
// 添加AutoMapper
builder.Services.AddXunetAutoMapper(ServiceAssembly.Assembly);
// 添加Swagger
builder.Services.AddXuetSwagger("Xunet.WebApi", "Xunet.Entity", "Xunet.Core");
// 添加缓存
builder.Services.AddXunetCache();
// 添加SqlSugar
builder.Services.AddXunetSqlSugar();
// 添加跨域
builder.Services.AddXunetCors();
// 添加认证
builder.Services.AddXunetAuthentication();
// 添加授权
builder.Services.AddXunetAuthorization<PermissionHandler>();
var app = builder.Build();
// 使用Session
app.UseSession();
// 使用异常中间件
app.UseXunetCustomException();
// 使用NLog
app.UseXunetNLog();
// 使用跨域
app.UseXunetCors();
// 使用HttpContextHelper
app.UseXunetHttpContextHelper();
// 使用Swagger
app.UseXunetSwagger();
// 使用SqlSugar => CodeFirst
app.UseXunetSqlSugar(new CodeFirstOptions
{
EntityAssembly = EntityAssembly.Assembly
//EntityTypes = new Type[] { }
});
// 使用路由
app.UseRouting();
// 使用Https
if (app.Environment.IsProduction())
{
app.UseHttpsRedirection();
}
// 使用认证
app.UseAuthentication();
// 使用授权
app.UseAuthorization();
// 使用控制器
app.MapControllers().RequireAuthorization(AuthorizePolicy.Default);
app.Run();
| 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 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
- Aliyun.OSS.SDK.NetCore (>= 2.13.0)
- Autofac (>= 6.2.0)
- Autofac.Extensions.DependencyInjection (>= 7.1.0)
- FluentScheduler (>= 5.5.1)
- FluentValidation.AspNetCore (>= 11.2.2)
- MicroElements.Swashbuckle.FluentValidation (>= 5.7.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 6.0.6)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 5.0.8)
- MiniProfiler.AspNetCore (>= 4.2.22)
- MySql.Data (>= 8.0.26)
- NLog (>= 4.7.10)
- NLog.Web.AspNetCore (>= 4.13.0)
- Swashbuckle.AspNetCore (>= 6.5.0)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.5.0)
- Xunet (>= 1.0.12)
-
net7.0
- Aliyun.OSS.SDK.NetCore (>= 2.13.0)
- Autofac (>= 6.2.0)
- Autofac.Extensions.DependencyInjection (>= 7.1.0)
- FluentScheduler (>= 5.5.1)
- FluentValidation.AspNetCore (>= 11.2.2)
- MicroElements.Swashbuckle.FluentValidation (>= 5.7.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 6.0.6)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 5.0.8)
- MiniProfiler.AspNetCore (>= 4.2.22)
- MySql.Data (>= 8.0.26)
- NLog (>= 4.7.10)
- NLog.Web.AspNetCore (>= 4.13.0)
- Swashbuckle.AspNetCore (>= 6.5.0)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.5.0)
- Xunet (>= 1.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|