LiteDBNoSQL 嵌入式數(shù)據(jù)庫(kù)
LiteDB 是一個(gè) .NET 開(kāi)發(fā)的小型快速輕量級(jí)的 NoSQL 嵌入式數(shù)據(jù)庫(kù),特性:
- 無(wú)服務(wù)器NoSQL文檔存儲(chǔ)
- 簡(jiǎn)單的API,類似于MongoDB
- 單個(gè)DLL(小于450kb)中的.NET 4.5 / NETStandard 1.3 / 2.0的100%C#代碼
- 線程安全
- 具有完整交易支持的ACID
- 寫(xiě)入失敗后的數(shù)據(jù)恢復(fù)(WAL日志文件)
- 使用DES(AES)加密的數(shù)據(jù)文件加密
- 將POCO類
BsonDocument映射為使用屬性或流利的映射器API - 存儲(chǔ)文件和流數(shù)據(jù)(例如MongoDB中的GridFS)
- 單個(gè)數(shù)據(jù)文件存儲(chǔ)(如SQLite)
- 索引文檔字段以快速搜索
- LINQ查詢支持
- 類似SQL的命令來(lái)訪問(wèn)/轉(zhuǎn)換數(shù)據(jù)
- LiteDB Studio-用于數(shù)據(jù)訪問(wèn)的漂亮UI
- 開(kāi)源,所有人免費(fèi)-包括商業(yè)用途
- 從NuGet安裝:
Install-Package LiteDB
使用方法:
// Open data file (or create if not exits)
using(var db = new LiteEngine(@"C:\Temp\MyData.db"))
{
// Get a collection (or create, if not exits)
var col = db.GetCollection<Customer>("customers");
var customer = new Customer { Id = 1, Name = "John Doe" };
// Insert new customer document
col.Insert(customer);
// Update a document inside a collection
customer.Name = "Joana Doe";
col.Update(customer);
// Index document using a document property
col.EnsureIndex(x => x.Name);
// Simple Linq support
var result = col.Find(x => x.Name.StartsWith("Jo"));
}評(píng)論
圖片
表情
