![]() |
VOOZH | about |
dotnet add package benxu.AppPlatform.Storage.LiteDB --version 3.2.7
NuGet\Install-Package benxu.AppPlatform.Storage.LiteDB -Version 3.2.7
<PackageReference Include="benxu.AppPlatform.Storage.LiteDB" Version="3.2.7" />
<PackageVersion Include="benxu.AppPlatform.Storage.LiteDB" Version="3.2.7" />Directory.Packages.props
<PackageReference Include="benxu.AppPlatform.Storage.LiteDB" />Project file
paket add benxu.AppPlatform.Storage.LiteDB --version 3.2.7
#r "nuget: benxu.AppPlatform.Storage.LiteDB, 3.2.7"
#:package benxu.AppPlatform.Storage.LiteDB@3.2.7
#addin nuget:?package=benxu.AppPlatform.Storage.LiteDB&version=3.2.7Install as a Cake Addin
#tool nuget:?package=benxu.AppPlatform.Storage.LiteDB&version=3.2.7Install as a Cake Tool
LiteDB 本地儲存實作 - 提供 Offline-first 的本地資料庫功能。
dotnet add package benxu.AppPlatform.Storage.LiteDB
using benxu.AppPlatform.Storage.LiteDB.Extensions;
// 使用預設設定
builder.Services.AddLiteDBStorage();
// 或自訂設定
builder.Services.AddLiteDBStorage(new LiteDBOptions
{
DatabaseName = "myapp.db",
EnableEncryption = true,
EncryptionPassword = "your-password"
});
public class MyService
{
private readonly ILocalStorage _storage;
public MyService(ILocalStorage storage)
{
_storage = storage;
}
public async Task SaveUserSettingsAsync(UserSettings settings)
{
var result = await _storage.SaveAsync("user_settings", settings);
if (result.IsSuccess)
{
Console.WriteLine("設定已儲存");
}
}
public async Task<UserSettings?> LoadUserSettingsAsync()
{
var result = await _storage.GetAsync<UserSettings>("user_settings");
return result.IsSuccess ? result.Data : null;
}
}
// 儲存
await _storage.SaveCollectionAsync("todos", new TodoItem
{
Id = 1,
Title = "學習 MAUI"
});
// 查詢
var result = await _storage.QueryCollectionAsync<TodoItem>(
"todos",
item => item.IsCompleted == false
);
// 取得所有
var allTodos = await _storage.GetAllFromCollectionAsync<TodoItem>("todos");
public class LiteDBOptions
{
public string DatabaseName { get; set; } = "appplatform.db";
public ConnectionType ConnectionMode { get; set; } = ConnectionType.Shared;
public bool EnableEncryption { get; set; }
public string? EncryptionPassword { get; set; }
public long InitialSize { get; set; }
public bool EnableLogging { get; set; }
}
資料庫檔案會儲存在平台的 LocalApplicationData 目錄:
%LOCALAPPDATA%~/Library/Application Support/data/data/{package}/files~/LibraryMIT License - Copyright (c) 2025 benxu
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on benxu.AppPlatform.Storage.LiteDB:
| Package | Downloads |
|---|---|
|
benxu.AppPlatform.MAUI.Bootstrap
Bootstrap package for benxu App Platform. Provides fluent API for one-line service registration and lifecycle management. |
|
|
benxu.AppPlatform.Notification
跨平台通知服務套件,提供 Android 和 iOS 的推播通知、本地通知管理功能,整合 Firebase Cloud Messaging (FCM) 服務,支援通知排程、通知歷程記錄與本地儲存,適用於 .NET MAUI Blazor 應用程式開發。 |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.7 | 93 | 6/5/2026 |
| 3.2.6 | 119 | 5/30/2026 |
| 3.2.5 | 139 | 4/25/2026 |
| 3.2.4 | 102 | 4/25/2026 |
| 3.2.3 | 109 | 4/23/2026 |
| 3.2.2 | 111 | 4/22/2026 |
| 3.2.1 | 113 | 4/17/2026 |
| 3.2.0 | 110 | 4/11/2026 |
| 3.1.9 | 112 | 4/10/2026 |
| 3.1.8 | 112 | 4/10/2026 |
| 3.1.7 | 110 | 4/10/2026 |
| 3.1.6 | 105 | 4/10/2026 |
| 3.1.5 | 107 | 4/9/2026 |
| 3.1.4 | 115 | 4/7/2026 |
| 3.1.3 | 120 | 3/24/2026 |
| 3.1.2 | 104 | 3/23/2026 |
| 3.1.1 | 108 | 3/22/2026 |
| 3.1.0 | 104 | 3/22/2026 |
| 3.0.9 | 107 | 3/20/2026 |
| 3.0.8 | 109 | 3/19/2026 |