SonnetDB.EntityFrameworkCore 3.0.1

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

SonnetDB.EntityFrameworkCore

SonnetDB.EntityFrameworkCore 是 SonnetDB 的 Entity Framework Core Provider,基于 SonnetDB ADO.NET 包提供关系表 CRUD、基础查询翻译、类型映射和 migrations SQL 支持。

本地连接字符串中的 Data Source=./demo-data 指向 SonnetDB 数据库目录,不是单个数据库文件。Provider 复用 SonnetDB ADO.NET 包,因此本地 / 远程连接边界与 ADO.NET 包一致。

本包未声明 Native AOT 兼容。EF Core 与 ADO.NET provider 都依赖运行时模型、表达式树和反射相关能力;需要 Native AOT 的嵌入式场景建议直接使用 SonnetDB.CoreTsdb API。

安装

dotnet add package SonnetDB.EntityFrameworkCore

最小示例

using Microsoft.EntityFrameworkCore;

var options = new DbContextOptionsBuilder<DeviceContext>()
    .UseSonnetDB("Data Source=./demo-data")
    .Options;

using var context = new DeviceContext(options);
await context.Database.MigrateAsync();

context.Devices.Add(new Device { Id = 1, Name = "pump", Enabled = true });
await context.SaveChangesAsync();

var online = await context.Devices
    .Where(device => device.Enabled)
    .ToListAsync();

当前范围

  • UseSonnetDB(...) 支持连接字符串和已有 DbConnection
  • 支持关系表基础 CRUD、类型映射、SQL 生成和 ToQueryString()
  • 支持 migrations SQL、默认 __EFMigrationsHistory 和自定义 history table。
  • 支持 StartsWithEndsWithContainsLIKE 的基础字符串模式翻译。

该 Provider 依赖 SonnetDB 当前关系表能力,完整兼容性以仓库测试和发布说明为准。

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.EntityFrameworkCore:

Package Downloads
DotNetDiag.HealthChecks.UI.SonnetDB.Storage

HealthChecks.UI.SonnetDB.Storage package contains the required classes to use SonnetDB provider in the UI

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on SonnetDB.EntityFrameworkCore:

Repository Stars
IoTSharp/GitCandy
A git server side platform based on .Net 10 一个基于.Net 10 的git服务端。QQ群:200319579。
Version Downloads Last Updated
3.0.1 151 7/8/2026
3.0.0 104 7/7/2026
2.5.0 186 6/26/2026
2.2.0 116 6/16/2026
2.1.1 127 6/15/2026