SonnetDB.Core 5.1.1

dotnet add package SonnetDB.Core --version 5.1.1
                    
NuGet\Install-Package SonnetDB.Core -Version 5.1.1
                    
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="SonnetDB.Core" Version="5.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SonnetDB.Core" Version="5.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SonnetDB.Core" />
                    
Project file
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 SonnetDB.Core --version 5.1.1
                    
#r "nuget: SonnetDB.Core, 5.1.1"
                    
#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 SonnetDB.Core@5.1.1
                    
#: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=SonnetDB.Core&version=5.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SonnetDB.Core&version=5.1.1
                    
Install as a Cake Tool

SonnetDB.Core

SonnetDB.Core 是 SonnetDB 的多模型核心引擎包,适合嵌入式本地数据库场景,包含时序、关系表、KV、文档、搜索、向量、对象存储适配、SonnetMQ 本地消息队列和公开原生属性图 API。

当前 SonnetDB 以数据库目录作为持久化边界,而不是单个数据库文件。嵌入式模式通过 TsdbOptions.RootDirectory 打开目录;目录内会按能力拆分 schema、catalog、WAL、segments、tombstone、KV / document 等文件。

SonnetDB.Core 继承仓库默认的 trim / Native AOT 分析配置,核心引擎路径面向 AOT 友好实现。需要 AOT 发布的嵌入式应用优先直接使用 Tsdb / SqlExecutor。

安装

dotnet add package SonnetDB.Core

最小示例

using SonnetDB.Engine;
using SonnetDB.Sql.Execution;

var root = Path.Combine(AppContext.BaseDirectory, "demo-data");

using var db = Tsdb.Open(new TsdbOptions
{
    RootDirectory = root,
});

SqlExecutor.Execute(db, """
    CREATE MEASUREMENT cpu (
        host TAG,
        usage FIELD FLOAT
    )
""");

SqlExecutor.Execute(db, """
    INSERT INTO cpu(host, usage, time)
    VALUES ('server-1', 63.2, 1776477601000)
""");

var result = (SelectExecutionResult)SqlExecutor.Execute(
    db,
    "SELECT time, usage FROM cpu WHERE host = 'server-1'")!;

foreach (var row in result.Rows)
{
    Console.WriteLine($"{row[0]} {row[1]}");
}

迁移与校验

MigrationService 复用一致性备份 manifest,提供 Export、Scan、Checksum、ImportDryRun 和 Import:

using SonnetDB.Backup;

var migration = new MigrationService();
var export = migration.Export(db, new MigrationExportOptions
{
    PackageDirectory = "./exports/demo-v1",
});

Console.WriteLine($"{export.Checksum.Verified}: {export.Checksum.PackageSha256}");

迁移包用于兼容 SonnetDB 数据库格式间的离线迁移和回滚准备,不是跨数据库产品的逻辑交换格式。

原生属性图 API

SonnetDB.Graphs 命名空间公开 GraphManager、GraphStore、GraphTransaction、GraphReadSession 和有界遍历合同。以下示例创建一个图并写入顶点:

using SonnetDB.Graphs;

var graphRoot = Path.Combine(AppContext.BaseDirectory, "demo-graphs");

using var graphManager = new GraphManager(graphRoot);
GraphStore graph = graphManager.Create("code");

GraphTransaction transaction = graph.BeginTransaction(Guid.NewGuid());
transaction.UpsertVertex(
    new GraphElementId(1),
    expectedElementVersion: 0,
    labels: [new LabelId(1)],
    properties: []);
transaction.Commit();

using GraphReadSession read = graph.BeginRead();
GraphVertex? vertex = read.GetVertex(new GraphElementId(1));
Console.WriteLine(vertex?.Id);

该 API 可用于固定版本的跨仓联调和能力验证。M40 的固定硬件、外部语义对拍、Native AOT journey、Couplet 联合门禁和 7 天生产证据尚未全部完成,因此包可用不等于 Native Graph Preview、Graph Beta 或 Production 门禁已经通过。

更多发布包、CLI 与服务端说明见仓库根目录 docs/releases/。

Product 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SonnetDB.Core:

Package Downloads
SonnetDB

SonnetDB 的 ADO.NET 提供程序,统一支持本地嵌入式连接与远程 SonnetDB 连接。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.1.1 0 11/15/2026
5.0.0 623 11/4/2026
4.5.0-preview.ef266.5 987 10/13/2026
4.0.0 3,532 9/27/2026
3.1.0 1,693 8/24/2026
3.0.1 2,876 7/8/2026
3.0.0 185 7/7/2026
2.5.0 350 6/26/2026
2.2.0 181 6/16/2026
2.1.1 221 6/15/2026
2.1.0 166 6/14/2026
2.0.0 179 6/14/2026
1.2.0 213 5/8/2026
1.1.0 153 5/6/2026
1.0.0 419 4/26/2026
0.2.1 155 5/3/2026
0.2.0 151 5/3/2026
0.1.0 139 5/3/2026