Lesphere.Framework.DatabaseAccessor
1.0.0
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 Lesphere.Framework.DatabaseAccessor --version 1.0.0
NuGet\Install-Package Lesphere.Framework.DatabaseAccessor -Version 1.0.0
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="Lesphere.Framework.DatabaseAccessor" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lesphere.Framework.DatabaseAccessor" Version="1.0.0" />
<PackageReference Include="Lesphere.Framework.DatabaseAccessor" />
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 Lesphere.Framework.DatabaseAccessor --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Lesphere.Framework.DatabaseAccessor, 1.0.0"
#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 Lesphere.Framework.DatabaseAccessor@1.0.0
#: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=Lesphere.Framework.DatabaseAccessor&version=1.0.0
#tool nuget:?package=Lesphere.Framework.DatabaseAccessor&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Lesphere Framework · 乐枢后端框架
适用于 .NET 10 的模块化后端公共库。业务服务按需选用,各包不依赖药店、平台或桌面项目。
| 包 | 职责 |
|---|---|
| Lesphere.Framework.Core | 公共异常与错误码、身份与密码规则、查询条件与分页、依赖注入、序列化、校验和基础扩展 |
| Lesphere.Framework.DatabaseAccessor | SqlSugar 仓储与连接选择、单连接事务、SQLite 维护基础、宿主实体元数据扩展 |
| Lesphere.Framework.AspNetCore | 统一结果与全局异常、可信请求身份、网关上下文、健康探针与 HTTP 管道 |
三个模块使用同一版本。DatabaseAccessor、AspNetCore 自动依赖 Core;仅使用基础工具时只需安装 Core。
dotnet add package Lesphere.Framework.Core --version 1.0.0
# 按需添加数据库或 Web 管道模块
dotnet add package Lesphere.Framework.DatabaseAccessor --version 1.0.0
dotnet add package Lesphere.Framework.AspNetCore --version 1.0.0
接入边界
- 公共异常位于
Lesphere.Framework.Exceptions;全局管道将业务失败映射为 HTTP 200 和success=false,认证、授权与基础设施故障保留实际 HTTP 状态。 SqlSugarUnitOfWorkManager管理单个数据库连接。跨服务操作通过 API 协调,不支持跨库原子事务。- 业务表、实体约束和租户隔离策略由宿主维护,可通过
IDatabaseSchemaMetadataProvider提供实体唯一约束。 - 应用启动不会自动创建、升级或备份数据库;结构维护需要显式调用维护能力。
- 数据访问包当前验证的数据库为 SQLite;枚举中的其他提供方不代表已包含对应驱动或完成适配验证。
- 桌面打印、本机传输、设备凭据不属于本框架。
公共规则示例
using Lesphere.Framework.Exceptions;
using Lesphere.Framework.Security;
// 密码校验只返回结论,不持有或记录密码原文。
var result = PasswordPolicy.Evaluate(password, userName);
if (!result.IsValid)
throw new BusinessException(result.ErrorMessage!);
库通过 XML 文档提供类型与方法说明。运行环境为 .NET 10;Web 模块还需要 ASP.NET Core 共享运行时。
仅使用 SQLite 的应用
SqlSugarCoreNoDrive 5.1.4.221 的上游 SystemCommon 8.5.0 元包仍声明 SQL Server 相关传递依赖。公共包保留上游依赖声明,不暗中改写消费方的还原策略。仅部署 SQLite 时,在应用自身的项目文件或 Directory.Packages.props 中添加:
<ItemGroup>
<PrunePackageReference Include="SystemCommon" Version="8.5.0" />
</ItemGroup>
然后执行 dotnet restore。此规则只针对已核验版本;升级 SqlSugar 后应重新验证。普通安装和采用此 SQLite 裁剪配置的安装均有独立消费端验证。框架源码所在工作区已配置相同规则。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- Lesphere.Framework.Core (>= 1.0.0)
- Microsoft.Data.Sqlite (>= 10.0.12)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Serilog (>= 4.3.1)
- SqlSugarCoreNoDrive (>= 5.1.4.221)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.