GoesSoftware.SuperSDK.Data
7.4.0
See the version list below for details.
dotnet add package GoesSoftware.SuperSDK.Data --version 7.4.0
NuGet\Install-Package GoesSoftware.SuperSDK.Data -Version 7.4.0
<PackageReference Include="GoesSoftware.SuperSDK.Data" Version="7.4.0" />
<PackageVersion Include="GoesSoftware.SuperSDK.Data" Version="7.4.0" />
<PackageReference Include="GoesSoftware.SuperSDK.Data" />
paket add GoesSoftware.SuperSDK.Data --version 7.4.0
#r "nuget: GoesSoftware.SuperSDK.Data, 7.4.0"
#:package GoesSoftware.SuperSDK.Data@7.4.0
#addin nuget:?package=GoesSoftware.SuperSDK.Data&version=7.4.0
#tool nuget:?package=GoesSoftware.SuperSDK.Data&version=7.4.0
SuperSDK.Data
数据访问层,基于 Entity Framework Core 和 SQLite 的数据持久化。支持对同一项目中的实体库和数据访问库进行代码混淆,表名 / 列名定义完全安全。
安装
dotnet add package GoesSoftware.SuperSDK.Data
使用示例
1. 定义实体模型
using SuperSDK.Data;
using System.ComponentModel.DataAnnotations;
// 实现 ITableEntity + IDatabaseEntity 接口:
// - DatabaseName / TableName 返回的是字符串字面量(数据,非标识符)
// - 混淆后 CLR 类型名会改变,但接口返回值不变 → 表名/数据库名永远正确
public class AppConfig : IEntity, IDatabaseEntity, ITableEntity
{
[Key]
public string Id { get; set; } = Guid.NewGuid().ToString();
[Required]
public string ConfigName { get; set; } = "";
public string ConfigValue { get; set; } = "";
// 指定数据库文件名(不含 .db 后缀)
public string DatabaseName => "MyApp";
// 指定 SQLite 表名(混淆安全:字符串字面量)
public string TableName => "AppConfig";
}
2. 初始化数据库
using SuperSDK.Data;
// 注册实体(可连续注册多个)
DbContextFactory.RegisterEntity<AppConfig>();
// 初始化(所有 RegisterEntity 调用后执行一次)
DbContextFactory.EnsureInitialized();
3. CRUD 操作
using SuperSDK.Data;
// 插入
var config = new AppConfig { ConfigName = "Theme", ConfigValue = "Dark" };
EntityStore.Insert(config);
// 查询所有
var all = EntityStore.GetAll<AppConfig>();
// 条件查询
var dark = EntityStore.Find<AppConfig>(c => c.ConfigValue == "Dark");
// 更新
config.ConfigValue = "Light";
EntityStore.Update(config);
// 删除
EntityStore.Delete(config);
🔐 加密字段
对于需要加密存储的敏感数据:
public class UserProfile : IEntity, IEncryptedEntity, IDatabaseEntity, ITableEntity
{
[Key]
public string Id { get; set; } = Guid.NewGuid().ToString();
public string Username { get; set; } = "";
// 加密字段 - 自动隔离到 secure.db(SQLCipher 加密)
[Encrypted]
public string Password { get; set; } = "";
[Encrypted]
public List<string> ApiKeys { get; set; } = new();
public string DatabaseName => "MyApp";
public string TableName => "UserProfile";
}
// 初始化加密数据库
EncryptedFieldManager.Initialize("Data/secure.db", "YourSecurePassword");
🛡️ 代码混淆支持
SuperSDK.Data 本身及所有使用它定义实体的库均可安全进行代码混淆(Obfuscar)。
混淆安全保证原理:
| 被混淆的东西 | 混淆前 | 混淆后 | 影响 |
|---|---|---|---|
| CLR 类型名 | AppConfig |
_A |
无影响(框架靠接口值定位表名) |
| 接口属性名 | TableName |
不变(接口约束保护) | 无影响 |
| 属性返回值 | "AppConfig" |
"AppConfig" |
字符串字面量,混淆器不改变数据 |
| 列名(属性名) | ConfigName |
不变(RenameProperties=false) |
无影响 |
约定:
- 实体必须实现
ITableEntity(TableName)和IDatabaseEntity(DatabaseName)接口,或使用[Table("名称")]特性 - 混淆时需设置
RenameProperties=false(防止 EF Core 列名变化) - 在任意库中定义的实体均遵循相同约定,均可混淆
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- GoesSoftware.SuperSDK.Core (>= 7.4.0)
- GoesSoftware.SuperSDK.License (>= 7.4.0)
- Microsoft.Data.Sqlite.Core (>= 9.0.0)
- Microsoft.EntityFrameworkCore.Sqlite (>= 9.0.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on GoesSoftware.SuperSDK.Data:
| Package | Downloads |
|---|---|
|
GoesSoftware.SuperSDK.UI
Avalonia UI 通用组件库 - 通知管理、对话框、ViewModelBase 等 |
|
|
GoesSoftware.SuperSDK.App
Application foundation framework for Avalonia-based Goes applications |
|
|
GoesSoftware.SuperSDK.Talk
SuperSDK AI 对话组件库 - 提供可扩展的聊天消息模型、ViewModel 层、渲染注册表与 Avalonia ChatBox 控件,原生集成 MessageBus |
|
|
GoesSoftware.SuperSDK.Editor
SuperSDK 编辑器组件库 - 提供文件浏览器、代码编辑器、版本控制面板,原生集成 MessageBus |
|
|
GoesSoftware.SuperSDK.Plot
SuperSDK 绘图与数据分析 UI 组件库 - 数据表格、SPC 图表、曲线绘制等 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 7.15.1 | 0 | 4/12/2026 |
| 7.15.0 | 0 | 4/12/2026 |
| 7.14.12 | 0 | 4/12/2026 |
| 7.14.11 | 0 | 4/12/2026 |
| 7.14.9 | 0 | 4/12/2026 |
| 7.14.8 | 0 | 4/12/2026 |
| 7.14.7 | 0 | 4/12/2026 |
| 7.14.6 | 0 | 4/12/2026 |
| 7.14.5 | 0 | 4/12/2026 |
| 7.14.3 | 26 | 4/11/2026 |
| 7.14.2 | 31 | 4/11/2026 |
| 7.14.0 | 41 | 4/10/2026 |
| 7.13.0 | 37 | 4/10/2026 |
| 7.12.0 | 36 | 4/10/2026 |
| 7.11.0 | 33 | 4/10/2026 |
| 7.10.0 | 68 | 4/8/2026 |
| 7.9.0 | 118 | 4/7/2026 |
| 7.8.0 | 161 | 4/4/2026 |
| 7.7.0 | 162 | 4/4/2026 |
| 7.4.0 | 159 | 4/4/2026 |
新增gocligonn