Zeek.Data.SqlServer 10.0.41
Zeek.Data.SqlServer
Zeek.Data.SqlServer 是 Zeek.Data 的 SQL Server 薄 provider,基于 Microsoft.Data.SqlClient 打开连接并注册数据库入口。
适用场景
- 桌面应用需要连接 SQL Server。
- 需要默认
IDatabase或 marker type 多库接入。 - 需要显式 initializer、事务和 ADO.NET / Dapper 查询入口。
安装 / 引用
发布包消费时引用:
<PackageReference Include="Zeek.Data.SqlServer" />
当前正式 sample 已切换为发布态 PackageReference 消费路径,版本由仓库根目录 Directory.Packages.props 统一管理。
快速开始
public static IReadOnlyList<ModuleDependency> Dependencies =>
[ModuleDependency.Of<SqlServerModule>()];
public void ConfigureServices(ModuleContext context)
{
context.UseSqlServer(connectionString)
.Initialize<AppSchema>();
}
多个 SQL Server 数据库使用不同 marker type,例如 IDatabase<MainDatabase> 和 IDatabase<AuditDatabase>。连接通过 OpenConnectionAsync(...) 获取,事务直接使用 SqlClient 的 ADO.NET API。
AOT / Trim
- AOT 支持等级:Supported。
- Trim 策略:显式
UseSqlServer(...)、显式 marker type、显式 initializer。 - 反射策略:仅 DI 构造;
Microsoft.Data.SqlClient行为按第三方依赖边界处理。
Sample
../../samples/Zeek.Data.RemoteDatabasesSample/
完整文档
../../docs/modules/Zeek.Data.SqlServer.md../../docs/modules/Zeek.Data.md
当前限制
- 没有 initializer 时,启动阶段不会主动连接外部数据库。
- Provider 不公开 Options 或自定义 exception;连接字符串注册期校验,driver exception 和取消语义原样保留。
- 真实连接验收需要可用 SQL Server 服务,不能只凭 build 声明连接通过。
- Provider 不提供 ORM、迁移平台或业务 Repository。
No packages depend on Zeek.Data.SqlServer.
.NET 10.0
- Zeek.Core (>= 10.0.41)
- Zeek.Data (>= 10.0.41)
- Microsoft.Data.SqlClient (>= 7.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
| Version | Downloads | Last updated |
|---|---|---|
| 10.0.42 | 3 | 07/29/2026 |
| 10.0.41 | 8 | 07/22/2026 |
| 10.0.40 | 3 | 07/22/2026 |
| 10.0.39 | 2 | 07/19/2026 |
| 10.0.38 | 3 | 07/17/2026 |
| 10.0.37 | 1 | 07/16/2026 |
| 10.0.36 | 5 | 06/29/2026 |
| 10.0.35 | 1 | 06/29/2026 |
| 10.0.31 | 5 | 06/27/2026 |
| 10.0.30 | 2 | 06/27/2026 |
| 10.0.29 | 2 | 06/26/2026 |
| 10.0.28 | 2 | 06/26/2026 |
| 10.0.27 | 2 | 06/26/2026 |
| 10.0.26 | 4 | 06/25/2026 |
| 10.0.25 | 3 | 06/24/2026 |