Zeek.Data.Sqlite 10.0.39

Zeek.Data.Sqlite

Zeek.Data.SqliteZeek.Data 的 SQLite 薄 provider,面向桌面应用本地文件数据库。

适用场景

  • 应用需要本地 SQLite 数据库。
  • 需要默认 IDatabase 或 marker type 多库接入。
  • 需要 SQLite 文件路径解析、父目录创建、WAL、foreign keys 和 busy timeout。
  • 需要启动阶段显式运行 initializer。

安装 / 引用

发布包消费时引用:

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

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

快速开始

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

public void ConfigureServices(ModuleContext context)
{
    context.UseSqlite(options =>
    {
        options.ApplicationName = "TodoApp";
        options.DatabaseFileName = "todos.db";
    })
    .Initialize<AppSchema>();
}

业务代码注入 IDatabase 后直接使用 ADO.NET、Dapper 或 Dapper.AOT。

没有 initializer 时 module start 不创建目录或数据库;首次 OpenConnectionAsync(...) 才访问文件。事务直接使用连接返回的 DbTransaction

AOT / Trim

  • AOT 支持等级:Supported。
  • Trim 策略:显式 UseSqlite(...)、显式 initializer,不扫描程序集。
  • 反射策略:仅 DI 构造;查询映射由应用选择。

Sample

  • ../../samples/Zeek.Data.SqliteSample/
  • ../../samples/Zeek.Data.DapperAotSample/

完整文档

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

当前限制

  • Provider 不封装查询映射,不提供迁移平台。
  • 文件路径安全规则要求默认路径名称为安全单段名称。
  • Native AOT 发布必须携带目标 RID 对应的 SQLite native asset,single-file 不等于没有 native sidecar。
  • Dapper.AOT 需要应用项目按 Dapper.AOT 要求启用 generator 和调用形态。

No packages depend on Zeek.Data.Sqlite.

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 4 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