Zeek.Data.PostgreSql 10.0.38

Zeek.Data.PostgreSql

Zeek.Data.PostgreSqlZeek.Data 的 PostgreSQL 薄 provider,基于 Npgsql 打开连接并注册数据库入口。

适用场景

  • 桌面应用需要连接 PostgreSQL。
  • 需要默认 IDatabase 或 marker type 多库接入。
  • 需要显式 initializer、事务和 ADO.NET / Dapper 查询入口。

安装 / 引用

发布包消费时引用:

<PackageReference Include="Zeek.Data.PostgreSql" />

当前正式 sample 已切换为发布态 PackageReference 消费路径,版本由仓库根目录 Directory.Packages.props 统一管理。

快速开始

public static IReadOnlyList<ModuleDependency> Dependencies =>
    [ModuleDependency.Of<PostgreSqlModule>()];

public void ConfigureServices(ModuleContext context)
{
    context.UsePostgreSql(connectionString)
        .Initialize<AppSchema>();
}

多个 PostgreSQL 数据库使用不同 marker type,例如 IDatabase<MainDatabase>IDatabase<AuditDatabase>。连接通过 OpenConnectionAsync(...) 获取,事务直接使用 Npgsql 的 ADO.NET API。

AOT / Trim

  • AOT 支持等级:Supported。
  • Trim 策略:显式 UsePostgreSql(...)、显式 marker type、显式 initializer。
  • 反射策略:仅 DI 构造;Npgsql 行为按第三方依赖边界处理。

Sample

  • ../../samples/Zeek.Data.RemoteDatabasesSample/

完整文档

  • ../../docs/modules/Zeek.Data.PostgreSql.md
  • ../../docs/modules/Zeek.Data.md

当前限制

  • 没有 initializer 时,启动阶段不会主动连接外部数据库。
  • Provider 不公开 Options 或自定义 exception;连接字符串注册期校验,driver exception 和取消语义原样保留。
  • 真实连接验收需要可用 PostgreSQL 服务,不能只凭 build 声明连接通过。
  • Provider 不提供 ORM、迁移平台或业务 Repository。

No packages depend on Zeek.Data.PostgreSql.

.NET 10.0

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